From 05af1f82b26ee807321a24b51b94798bec121036 Mon Sep 17 00:00:00 2001 From: chris48s Date: Sun, 21 Apr 2019 21:10:30 +0100 Subject: [PATCH] refactor [vaadindirectory] badges (#3339) --- .../vaadin-directory/vaadin-directory-base.js | 34 +++ .../vaadin-directory-rating-count.service.js | 46 +++ .../vaadin-directory-rating-count.tester.js | 25 ++ .../vaadin-directory-rating.service.js | 55 ++++ .../vaadin-directory-rating.tester.js | 33 +++ .../vaadin-directory-release-date.service.js | 45 +++ .../vaadin-directory-release-date.tester.js | 22 ++ .../vaadin-directory-status.service.js | 43 +++ .../vaadin-directory-status.tester.js | 18 ++ .../vaadin-directory-version.service.js | 39 +++ .../vaadin-directory-version.tester.js | 25 ++ .../vaadin-directory.service.js | 272 ------------------ .../vaadin-directory.tester.js | 106 ------- 13 files changed, 385 insertions(+), 378 deletions(-) create mode 100644 services/vaadin-directory/vaadin-directory-base.js create mode 100644 services/vaadin-directory/vaadin-directory-rating-count.service.js create mode 100644 services/vaadin-directory/vaadin-directory-rating-count.tester.js create mode 100644 services/vaadin-directory/vaadin-directory-rating.service.js create mode 100644 services/vaadin-directory/vaadin-directory-rating.tester.js create mode 100644 services/vaadin-directory/vaadin-directory-release-date.service.js create mode 100644 services/vaadin-directory/vaadin-directory-release-date.tester.js create mode 100644 services/vaadin-directory/vaadin-directory-status.service.js create mode 100644 services/vaadin-directory/vaadin-directory-status.tester.js create mode 100644 services/vaadin-directory/vaadin-directory-version.service.js create mode 100644 services/vaadin-directory/vaadin-directory-version.tester.js delete mode 100644 services/vaadin-directory/vaadin-directory.service.js delete mode 100644 services/vaadin-directory/vaadin-directory.tester.js diff --git a/services/vaadin-directory/vaadin-directory-base.js b/services/vaadin-directory/vaadin-directory-base.js new file mode 100644 index 0000000000000..c64ec77da914a --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-base.js @@ -0,0 +1,34 @@ +'use strict' + +const Joi = require('joi') +const { BaseJsonService } = require('..') +const { nonNegativeInteger } = require('../validators') + +const schema = Joi.object({ + ratingCount: nonNegativeInteger, + averageRating: Joi.number() + .min(0) + .required(), + latestAvailableRelease: Joi.object({ + publicationDate: Joi.date().required(), + name: Joi.string().required(), + }).required(), + status: Joi.string().required(), +}).required() + +class BaseVaadinDirectoryService extends BaseJsonService { + async fetch({ packageName }) { + return this._requestJson({ + schema, + url: `https://vaadin.com/vaadincom/directory-service/components/search/findByUrlIdentifier`, + options: { + qs: { + projection: 'summary', + urlIdentifier: packageName, + }, + }, + }) + } +} + +module.exports = { BaseVaadinDirectoryService } diff --git a/services/vaadin-directory/vaadin-directory-rating-count.service.js b/services/vaadin-directory/vaadin-directory-rating-count.service.js new file mode 100644 index 0000000000000..07aff6fbd5fb2 --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-rating-count.service.js @@ -0,0 +1,46 @@ +'use strict' + +const { metric } = require('../text-formatters') +const { floorCount: floorCountColor } = require('../color-formatters') +const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') + +module.exports = class VaadinDirectoryRatingCount extends BaseVaadinDirectoryService { + static get category() { + return 'rating' + } + + static get route() { + return { + base: 'vaadin-directory', + pattern: ':which(rc|rating-count)/:packageName', + } + } + + static get examples() { + return [ + { + title: 'Vaadin Directory', + pattern: 'rating-count/:packageName', + namedParams: { packageName: 'vaadinvaadin-grid' }, + staticPreview: this.render({ ratingCount: 6 }), + keywords: ['vaadin-directory', 'rating-count', 'rating count'], + }, + ] + } + + static get defaultBadgeData() { + return { label: 'rating count' } + } + + static render({ ratingCount }) { + return { + message: `${metric(ratingCount)} total`, + color: floorCountColor(ratingCount, 5, 50, 500), + } + } + + async handle({ which, packageName }) { + const { ratingCount } = await this.fetch({ packageName }) + return this.constructor.render({ ratingCount }) + } +} diff --git a/services/vaadin-directory/vaadin-directory-rating-count.tester.js b/services/vaadin-directory/vaadin-directory-rating-count.tester.js new file mode 100644 index 0000000000000..fe096f2d0ef4e --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-rating-count.tester.js @@ -0,0 +1,25 @@ +'use strict' + +const Joi = require('joi') +const t = (module.exports = require('../tester').createServiceTester()) + +t.create('rating count of component') + .get('/rating-count/vaadinvaadin-grid.json') + .expectBadge({ + label: 'rating count', + message: Joi.string().regex(/^\d+?\stotal$/), + }) + +t.create('rating count of component') + .get('/rc/vaadinvaadin-grid.json') + .expectBadge({ + label: 'rating count', + message: Joi.string().regex(/^\d+?\stotal$/), + }) + +t.create('not found') + .get('/rating-count/does-not-exist.json') + .expectBadge({ + label: 'rating count', + message: 'not found', + }) diff --git a/services/vaadin-directory/vaadin-directory-rating.service.js b/services/vaadin-directory/vaadin-directory-rating.service.js new file mode 100644 index 0000000000000..6b24e6f2a1936 --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-rating.service.js @@ -0,0 +1,55 @@ +'use strict' + +const { starRating } = require('../text-formatters') +const { floorCount: floorCountColor } = require('../color-formatters') +const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') + +module.exports = class VaadinDirectoryRating extends BaseVaadinDirectoryService { + static get category() { + return 'rating' + } + + static get route() { + return { + base: 'vaadin-directory', + pattern: ':which(star|stars|rating)/:packageName', + } + } + + static get examples() { + return [ + { + title: 'Vaadin Directory', + pattern: ':which(stars|rating)/:packageName', + namedParams: { which: 'rating', packageName: 'vaadinvaadin-grid' }, + staticPreview: this.render({ which: 'rating', score: 4.75 }), + keywords: ['vaadin-directory', 'rating'], + }, + ] + } + + static get defaultBadgeData() { + return { label: 'rating' } + } + + static render({ which, score }) { + const rating = (Math.round(score * 10) / 10).toFixed(1) + if (which === 'rating') { + return { + label: 'rating', + message: `${rating}/5`, + color: floorCountColor(rating, 2, 3, 4), + } + } + return { + label: 'stars', + message: starRating(rating), + color: floorCountColor(rating, 2, 3, 4), + } + } + + async handle({ which, packageName }) { + const { averageRating } = await this.fetch({ packageName }) + return this.constructor.render({ which, score: averageRating }) + } +} diff --git a/services/vaadin-directory/vaadin-directory-rating.tester.js b/services/vaadin-directory/vaadin-directory-rating.tester.js new file mode 100644 index 0000000000000..87cb3db2ccba9 --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-rating.tester.js @@ -0,0 +1,33 @@ +'use strict' + +const Joi = require('joi') +const { isStarRating } = require('../test-validators') +const t = (module.exports = require('../tester').createServiceTester()) + +t.create('stars of component displayed in star icons') + .get('/star/vaadinvaadin-grid.json') + .expectBadge({ + label: 'stars', + message: isStarRating, + }) + +t.create('stars of component displayed in star icons') + .get('/stars/vaadinvaadin-grid.json') + .expectBadge({ + label: 'stars', + message: isStarRating, + }) + +t.create('rating of the component (eg: 4.2/5)') + .get('/rating/vaadinvaadin-grid.json') + .expectBadge({ + label: 'rating', + message: Joi.string().regex(/^\d\.\d\/5$/), + }) + +t.create('not found') + .get('/rating/does-not-exist.json') + .expectBadge({ + label: 'rating', + message: 'not found', + }) diff --git a/services/vaadin-directory/vaadin-directory-release-date.service.js b/services/vaadin-directory/vaadin-directory-release-date.service.js new file mode 100644 index 0000000000000..b8be194121ac5 --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-release-date.service.js @@ -0,0 +1,45 @@ +'use strict' + +const { formatDate } = require('../text-formatters') +const { age: ageColor } = require('../color-formatters') +const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') + +module.exports = class VaadinDirectoryReleaseDate extends BaseVaadinDirectoryService { + static get category() { + return 'activity' + } + + static get route() { + return { + base: 'vaadin-directory', + pattern: ':which(rd|release-date)/:packageName', + } + } + + static get examples() { + return [ + { + title: 'Vaadin Directory', + pattern: 'release-date/:packageName', + namedParams: { packageName: 'vaadinvaadin-grid' }, + staticPreview: this.render({ date: '2018-12-12' }), + keywords: ['vaadin-directory', 'date', 'latest release date'], + }, + ] + } + + static get defaultBadgeData() { + return { label: 'latest release date' } + } + + static render({ date }) { + return { message: formatDate(date), color: ageColor(date) } + } + + async handle({ which, packageName }) { + const data = await this.fetch({ packageName }) + return this.constructor.render({ + date: data.latestAvailableRelease.publicationDate, + }) + } +} diff --git a/services/vaadin-directory/vaadin-directory-release-date.tester.js b/services/vaadin-directory/vaadin-directory-release-date.tester.js new file mode 100644 index 0000000000000..f5102380ea68b --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-release-date.tester.js @@ -0,0 +1,22 @@ +'use strict' + +const { isFormattedDate } = require('../test-validators') +const t = (module.exports = require('../tester').createServiceTester()) + +t.create('latest release date of the component (format: yyyy-mm-dd)') + .get('/rd/vaadinvaadin-grid.json') + .expectBadge({ + label: 'latest release date', + message: isFormattedDate, + }) + +t.create('latest release date of the component (format: yyyy-mm-dd)') + .get('/release-date/vaadinvaadin-grid.json') + .expectBadge({ + label: 'latest release date', + message: isFormattedDate, + }) + +t.create('not found') + .get('/release-date/does-not-exist.json') + .expectBadge({ label: 'latest release date', message: 'not found' }) diff --git a/services/vaadin-directory/vaadin-directory-status.service.js b/services/vaadin-directory/vaadin-directory-status.service.js new file mode 100644 index 0000000000000..8e0521b88ada1 --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-status.service.js @@ -0,0 +1,43 @@ +'use strict' + +const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') + +module.exports = class VaadinDirectoryStatus extends BaseVaadinDirectoryService { + static get category() { + return 'other' + } + + static get route() { + return { + base: 'vaadin-directory/status', + pattern: ':packageName', + } + } + + static get examples() { + return [ + { + title: 'Vaadin Directory', + namedParams: { packageName: 'vaadinvaadin-grid' }, + staticPreview: this.render({ status: 'published' }), + keywords: ['vaadin-directory', 'status'], + }, + ] + } + + static get defaultBadgeData() { + return { label: 'vaadin directory' } + } + + static render({ status }) { + if (status.toLowerCase() === 'published') { + return { message: 'published', color: '#00b4f0' } + } + return { message: 'unpublished' } + } + + async handle({ packageName }) { + const { status } = await this.fetch({ packageName }) + return this.constructor.render({ status }) + } +} diff --git a/services/vaadin-directory/vaadin-directory-status.tester.js b/services/vaadin-directory/vaadin-directory-status.tester.js new file mode 100644 index 0000000000000..51abd9b9e1fe5 --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-status.tester.js @@ -0,0 +1,18 @@ +'use strict' + +const Joi = require('joi') +const t = (module.exports = require('../tester').createServiceTester()) + +t.create('publish status of the component') + .get('/vaadinvaadin-grid.json') + .expectBadge({ + label: 'vaadin directory', + message: Joi.equal('published', 'unpublished'), + }) + +t.create('not found') + .get('/does-not-exist.json') + .expectBadge({ + label: 'vaadin directory', + message: 'not found', + }) diff --git a/services/vaadin-directory/vaadin-directory-version.service.js b/services/vaadin-directory/vaadin-directory-version.service.js new file mode 100644 index 0000000000000..3f2b5670bada6 --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-version.service.js @@ -0,0 +1,39 @@ +'use strict' + +const { renderVersionBadge } = require('../version') +const { BaseVaadinDirectoryService } = require('./vaadin-directory-base') + +module.exports = class VaadinDirectoryVersion extends BaseVaadinDirectoryService { + static get category() { + return 'version' + } + + static get route() { + return { + base: 'vaadin-directory', + pattern: ':which(v|version)/:packageName', + } + } + + static get examples() { + return [ + { + title: 'Vaadin Directory', + pattern: 'v/:packageName', + namedParams: { packageName: 'vaadinvaadin-grid' }, + staticPreview: renderVersionBadge({ version: 'v5.3.0-alpha4' }), + keywords: ['vaadin-directory', 'version', 'latest version'], + }, + ] + } + + static get defaultBadgeData() { + return { label: 'vaadin directory' } + } + + async handle({ which, packageName }) { + const data = await this.fetch({ packageName }) + const lv = data.latestAvailableRelease.name.toLowerCase() + return renderVersionBadge({ version: lv }) + } +} diff --git a/services/vaadin-directory/vaadin-directory-version.tester.js b/services/vaadin-directory/vaadin-directory-version.tester.js new file mode 100644 index 0000000000000..e498041c09c17 --- /dev/null +++ b/services/vaadin-directory/vaadin-directory-version.tester.js @@ -0,0 +1,25 @@ +'use strict' + +const { isSemver } = require('../test-validators') +const t = (module.exports = require('../tester').createServiceTester()) + +t.create('latest version of the component (can have v prefixed or without)') + .get('/v/vaadinvaadin-grid.json') + .expectBadge({ + label: 'vaadin directory', + message: isSemver, + }) + +t.create('latest version of the component (can have v prefixed or without)') + .get('/version/vaadinvaadin-grid.json') + .expectBadge({ + label: 'vaadin directory', + message: isSemver, + }) + +t.create('not found') + .get('/v/does-not-exist.json') + .expectBadge({ + label: 'vaadin directory', + message: 'not found', + }) diff --git a/services/vaadin-directory/vaadin-directory.service.js b/services/vaadin-directory/vaadin-directory.service.js deleted file mode 100644 index 08ebfc6803224..0000000000000 --- a/services/vaadin-directory/vaadin-directory.service.js +++ /dev/null @@ -1,272 +0,0 @@ -'use strict' - -const LegacyService = require('../legacy-service') -const { - makeBadgeData: getBadgeData, - makeLabel: getLabel, -} = require('../../lib/badge-data') -const { checkErrorResponse } = require('../../lib/error-helper') -const { metric, starRating, formatDate } = require('../text-formatters') -const { - floorCount: floorCountColor, - age: ageColor, -} = require('../color-formatters') - -class VaadinDirectoryRating extends LegacyService { - static get category() { - return 'rating' - } - - static get route() { - return { - base: 'vaadin-directory', - pattern: ':which(rating|stars|rating-count)/:packageName', - } - } - - static get examples() { - return [ - { - title: 'Vaadin Directory', - pattern: 'rating/:packageName', - namedParams: { packageName: 'vaadinvaadin-grid' }, - staticPreview: { - label: 'rating', - message: '5.0/5', - color: 'brightgreen', - }, - keywords: ['vaadin-directory', 'rating'], - }, - { - title: 'Vaadin Directory', - pattern: 'stars/:packageName', - namedParams: { packageName: 'vaadinvaadin-grid' }, - staticPreview: { - label: 'stars', - message: starRating(4.75), - color: 'brightgreen', - }, - keywords: ['vaadin-directory', 'star', 'stars'], - }, - { - title: 'Vaadin Directory', - pattern: 'rating-count/:packageName', - namedParams: { packageName: 'vaadinvaadin-grid' }, - staticPreview: { - label: 'rating count', - message: '6 total', - color: 'yellow', - }, - keywords: ['vaadin-directory', 'rating-count', 'rating count'], - }, - ] - } - - static registerLegacyRouteHandler() {} -} - -class VaadinDirectoryVersion extends LegacyService { - static get category() { - return 'version' - } - - static get route() { - return { - base: 'vaadin-directory/v', - pattern: ':packageName', - } - } - - static get examples() { - return [ - { - title: 'Vaadin Directory', - namedParams: { packageName: 'vaadinvaadin-grid' }, - staticPreview: { - label: 'latest ver', - message: 'v5.3.0-alpha4', - color: '00b4f0', - }, - keywords: ['vaadin-directory', 'version', 'latest version'], - }, - ] - } - - static registerLegacyRouteHandler() {} -} - -class VaadinDirectoryStatus extends LegacyService { - static get category() { - return 'other' - } - - static get route() { - return { - base: 'vaadin-directory/status', - pattern: ':packageName', - } - } - - static get examples() { - return [ - { - title: 'Vaadin Directory', - namedParams: { packageName: 'vaadinvaadin-grid' }, - staticPreview: { - label: 'vaadin directory', - message: 'published', - color: '00b4f0', - }, - keywords: ['vaadin-directory', 'status'], - }, - ] - } - - static registerLegacyRouteHandler() {} -} - -class VaadinDirectoryReleaseDate extends LegacyService { - static get category() { - return 'activity' - } - - static get route() { - return { - base: 'vaadin-directory/release-date', - pattern: ':packageName', - } - } - - static get examples() { - return [ - { - title: 'Vaadin Directory', - namedParams: { packageName: 'vaadinvaadin-grid' }, - staticPreview: { - label: 'latest release date', - message: 'last wednesday', - color: 'brightgreen', - }, - keywords: ['vaadin-directory', 'date', 'latest release date'], - }, - ] - } - - static registerLegacyRouteHandler() {} -} - -// This legacy service should be rewritten to use e.g. BaseJsonService. -// -// Tips for rewriting: -// https://github.com/badges/shields/blob/master/doc/rewriting-services.md -// -// Do not base new services on this code. -class VaadinDirectory extends LegacyService { - static get category() { - return 'other' - } - - static get route() { - return { - base: 'vaadin-directory', - pattern: - ':which(star|stars|status|rating|rc|rating-count|v|version|rd|release-date)/:urlIdentifier', - } - } - - static registerLegacyRouteHandler({ camp, cache }) { - camp.route( - /^\/vaadin-directory\/(star|stars|status|rating|rc|rating-count|v|version|rd|release-date)\/(.*).(svg|png|gif|jpg|json)$/, - cache((data, match, sendBadge, request) => { - const type = match[1] // Field required - const urlIdentifier = match[2] // Name of repository - const format = match[3] // Format - // API URL which contains also authentication info - const apiUrl = `https://vaadin.com/vaadincom/directory-service/components/search/findByUrlIdentifier?projection=summary&urlIdentifier=${urlIdentifier}` - - // Set left-side text to 'Vaadin-Directory' by default - const badgeData = getBadgeData('vaadin directory', data) - request(apiUrl, (err, res, buffer) => { - if (checkErrorResponse(badgeData, err, res)) { - sendBadge(format, badgeData) - return - } - - try { - const data = JSON.parse(buffer) - // Round the rating to 1 points decimal - const rating = (Math.round(data.averageRating * 10) / 10).toFixed(1) - const ratingCount = data.ratingCount - const lv = data.latestAvailableRelease.name.toLowerCase() - const ld = data.latestAvailableRelease.publicationDate - switch (type) { - // Since the first deploy was with `star`, I put the case there - // for safety pre-caution - case 'star': - case 'stars': // Stars - badgeData.text[0] = getLabel('stars', data) - badgeData.text[1] = starRating(rating) - badgeData.colorscheme = floorCountColor(rating, 2, 3, 4) - break - case 'status': { - // Status of the component - const isPublished = data.status.toLowerCase() - if (isPublished === 'published') { - badgeData.text[1] = 'published' - badgeData.colorB = '#00b4f0' - } else { - badgeData.text[1] = 'unpublished' - } - break - } - case 'rating': // rating - badgeData.text[0] = getLabel('rating', data) - if (!isNaN(rating)) { - badgeData.text[1] = `${rating}/5` - badgeData.colorscheme = floorCountColor(rating, 2, 3, 4) - } - break - case 'rc': // rating count - case 'rating-count': - badgeData.text[0] = getLabel('rating count', data) - if (ratingCount && ratingCount !== 0) { - badgeData.text[1] = `${metric(data.ratingCount)} total` - badgeData.colorscheme = floorCountColor( - data.ratingCount, - 5, - 50, - 500 - ) - } - break - case 'v': // latest version - case 'version': - badgeData.text[0] = getLabel('latest ver', data) - badgeData.text[1] = lv - badgeData.colorB = '#00b4f0' - break - case 'rd': - case 'release-date': // The release date of the latest version - badgeData.text[0] = getLabel('latest release date', data) - badgeData.text[1] = formatDate(ld) - badgeData.colorscheme = ageColor(ld) - break - } - sendBadge(format, badgeData) - } catch (e) { - badgeData.text[1] = 'invalid' - sendBadge(format, badgeData) - } - }) - }) - ) - } -} - -module.exports = { - VaadinDirectoryRating, - VaadinDirectoryVersion, - VaadinDirectoryStatus, - VaadinDirectoryReleaseDate, - VaadinDirectory, -} diff --git a/services/vaadin-directory/vaadin-directory.tester.js b/services/vaadin-directory/vaadin-directory.tester.js deleted file mode 100644 index a78a47e6b3fae..0000000000000 --- a/services/vaadin-directory/vaadin-directory.tester.js +++ /dev/null @@ -1,106 +0,0 @@ -'use strict' - -const Joi = require('joi') -const { - isSemver, - isStarRating, - isFormattedDate, -} = require('../test-validators') -const { ServiceTester } = require('../tester') - -const t = (module.exports = new ServiceTester({ - id: 'vaadin-directory', - title: 'vaadin directory', -})) - -t.create('stars of component displayed in star icons') - .get('/star/vaadinvaadin-grid.json') - .expectBadge({ - label: 'stars', - message: isStarRating, - }) - -t.create('stars of component displayed in star icons') - .get('/stars/vaadinvaadin-grid.json') - .expectBadge({ - label: 'stars', - message: isStarRating, - }) - -t.create('publish status of the component') - .get('/status/vaadinvaadin-grid.json') - .expectBadge({ - label: 'vaadin directory', - message: Joi.equal( - 'published', - 'unpublished', - 'incomplete', - 'reported', - 'suspended', - 'deleted' - ), - }) - -t.create('rating of the component (eg: 4.2/5)') - .get('/rating/vaadinvaadin-grid.json') - .expectBadge({ - label: 'rating', - message: Joi.string().regex(/^\d\.\d\/5$/), - }) - -t.create('rating count of component') - .get('/rc/vaadinvaadin-grid.json') - .expectBadge({ - label: 'rating count', - message: Joi.string().regex(/^\d+?\stotal$/), - }) - -t.create('rating count of component') - .get('/rating-count/vaadinvaadin-grid.json') - .expectBadge({ - label: 'rating count', - message: Joi.string().regex(/^\d+?\stotal$/), - }) - -t.create('latest version of the component (can have v prefixed or without)') - .get('/v/vaadinvaadin-grid.json') - .expectBadge({ - label: 'latest ver', - message: isSemver, - }) - -t.create('latest version of the component (can have v prefixed or without)') - .get('/version/vaadinvaadin-grid.json') - .expectBadge({ - label: 'latest ver', - message: isSemver, - }) - -t.create('latest release date of the component (format: yyyy-mm-dd)') - .get('/rd/vaadinvaadin-grid.json') - .expectBadge({ - label: 'latest release date', - message: isFormattedDate, - }) - -t.create('latest release date of the component (format: yyyy-mm-dd)') - .get('/release-date/vaadinvaadin-grid.json') - .expectBadge({ - label: 'latest release date', - message: isFormattedDate, - }) - -t.create('Invalid addon') - .get('/stars/404.json') - .expectBadge({ - label: 'vaadin directory', - message: 'not found', - }) - -t.create('No connection') - .get('/stars/vaadinvaadin-grid.json') - .networkOff() - .expectBadge({ - label: 'vaadin directory', - message: 'inaccessible', - })