1
0
mirror of https://github.com/badges/shields.git synced 2025-11-09 12:40:59 +03:00

More example urls and static examples [apm waffle] (#2478)

This commit is contained in:
Paul Melnikow
2018-12-11 16:31:01 -05:00
committed by GitHub
parent d74568b9c9
commit 88c8b0ee3e
27 changed files with 289 additions and 82 deletions

View File

@@ -8,7 +8,9 @@ const BaseJsonService = require('../base-json')
const { InvalidResponse } = require('../errors') const { InvalidResponse } = require('../errors')
const { nonNegativeInteger } = require('../validators') const { nonNegativeInteger } = require('../validators')
const apmSchema = Joi.object({ const keywords = ['atom']
const schema = Joi.object({
downloads: nonNegativeInteger, downloads: nonNegativeInteger,
releases: Joi.object({ releases: Joi.object({
latest: Joi.string().required(), latest: Joi.string().required(),
@@ -19,10 +21,10 @@ const apmSchema = Joi.object({
}) })
class BaseAPMService extends BaseJsonService { class BaseAPMService extends BaseJsonService {
async fetch({ repo }) { async fetch({ packageName }) {
return this._requestJson({ return this._requestJson({
schema: apmSchema, schema,
url: `https://atom.io/api/packages/${repo}`, url: `https://atom.io/api/packages/${packageName}`,
errorMessages: { 404: 'package not found' }, errorMessages: { 404: 'package not found' },
}) })
} }
@@ -37,8 +39,8 @@ class APMDownloads extends BaseAPMService {
return { message: metric(downloads), color: 'green' } return { message: metric(downloads), color: 'green' }
} }
async handle({ repo }) { async handle({ packageName }) {
const json = await this.fetch({ repo }) const json = await this.fetch({ packageName })
return this.constructor.render({ downloads: json.downloads }) return this.constructor.render({ downloads: json.downloads })
} }
@@ -53,17 +55,17 @@ class APMDownloads extends BaseAPMService {
static get route() { static get route() {
return { return {
base: 'apm/dm', base: 'apm/dm',
pattern: ':repo', pattern: ':packageName',
} }
} }
static get examples() { static get examples() {
return [ return [
{ {
exampleUrl: 'vim-mode', title: 'APM',
pattern: ':package', namedParams: { packageName: 'vim-mode' },
staticExample: this.render({ downloads: '60043' }), staticExample: this.render({ downloads: '60043' }),
keywords: ['atom'], keywords,
}, },
] ]
} }
@@ -74,8 +76,8 @@ class APMVersion extends BaseAPMService {
return renderVersionBadge({ version }) return renderVersionBadge({ version })
} }
async handle({ repo }) { async handle({ packageName }) {
const json = await this.fetch({ repo }) const json = await this.fetch({ packageName })
const version = json.releases.latest const version = json.releases.latest
if (!version) if (!version)
@@ -92,18 +94,17 @@ class APMVersion extends BaseAPMService {
static get route() { static get route() {
return { return {
base: 'apm/v', base: 'apm/v',
format: '(.+)', pattern: ':packageName',
capture: ['repo'],
} }
} }
static get examples() { static get examples() {
return [ return [
{ {
exampleUrl: 'vim-mode', title: 'APM',
pattern: ':package', namedParams: { packageName: 'vim-mode' },
staticExample: this.render({ version: '0.6.0' }), staticExample: this.render({ version: '0.6.0' }),
keywords: ['atom'], keywords,
}, },
] ]
} }
@@ -114,8 +115,8 @@ class APMLicense extends BaseAPMService {
return renderLicenseBadge({ license }) return renderLicenseBadge({ license })
} }
async handle({ repo }) { async handle({ packageName }) {
const json = await this.fetch({ repo }) const json = await this.fetch({ packageName })
const license = json.metadata.license const license = json.metadata.license
if (!license) if (!license)
@@ -136,18 +137,17 @@ class APMLicense extends BaseAPMService {
static get route() { static get route() {
return { return {
base: 'apm/l', base: 'apm/l',
format: '(.+)', pattern: ':packageName',
capture: ['repo'],
} }
} }
static get examples() { static get examples() {
return [ return [
{ {
exampleUrl: 'vim-mode', title: 'APM',
pattern: ':package', namedParams: { packageName: 'vim-mode' },
staticExample: this.render({ license: 'MIT' }), staticExample: this.render({ license: 'MIT' }),
keywords: ['atom'], keywords,
}, },
] ]
} }

View File

@@ -12,6 +12,7 @@ module.exports = class BowerLicense extends LegacyService {
static get route() { static get route() {
return { return {
base: 'bower/l', base: 'bower/l',
pattern: ':packageName',
} }
} }
@@ -19,7 +20,8 @@ module.exports = class BowerLicense extends LegacyService {
return [ return [
{ {
title: 'Bower', title: 'Bower',
previewUrl: 'bootstrap', namedParams: { packageName: 'bootstrap' },
staticPreview: { label: 'license', message: 'MIT', color: 'blue' },
}, },
] ]
} }

View File

@@ -10,6 +10,7 @@ module.exports = class CocoapodsLicense extends LegacyService {
static get route() { static get route() {
return { return {
base: 'cocoapods/l', base: 'cocoapods/l',
pattern: ':packageName',
} }
} }
@@ -17,7 +18,8 @@ module.exports = class CocoapodsLicense extends LegacyService {
return [ return [
{ {
title: 'Cocoapods', title: 'Cocoapods',
previewUrl: 'AFNetworking', namedParams: { packageName: 'AFNetworking' },
staticPreview: { label: 'license', message: 'MIT', color: '000' },
}, },
] ]
} }

View File

@@ -10,6 +10,7 @@ module.exports = class CocoapodsPlatform extends LegacyService {
static get route() { static get route() {
return { return {
base: 'cocoapods/p', base: 'cocoapods/p',
pattern: ':packageName',
} }
} }
@@ -17,7 +18,12 @@ module.exports = class CocoapodsPlatform extends LegacyService {
return [ return [
{ {
title: 'Cocoapods', title: 'Cocoapods',
previewUrl: 'AFNetworking', namedParams: { packageName: 'AFNetworking' },
staticPreview: {
label: 'platform',
message: 'ios | osx | watchos | tvos',
color: 'lightgrey',
},
}, },
] ]
} }

View File

@@ -10,6 +10,7 @@ module.exports = class CpanLicense extends LegacyService {
static get route() { static get route() {
return { return {
base: 'cpan/l', base: 'cpan/l',
pattern: ':packageName',
} }
} }
@@ -17,7 +18,8 @@ module.exports = class CpanLicense extends LegacyService {
return [ return [
{ {
title: 'CPAN', title: 'CPAN',
previewUrl: 'Config-Augeas', namedParams: { packageName: 'Config-Augeas' },
staticPreview: { label: 'CPAN', message: 'lgpl_2_1', color: 'blue' },
keywords: ['perl'], keywords: ['perl'],
}, },
] ]

View File

@@ -16,6 +16,7 @@ class CranLicense extends LegacyService {
static get route() { static get route() {
return { return {
base: 'cran/l', base: 'cran/l',
pattern: ':packageName',
} }
} }
@@ -23,7 +24,12 @@ class CranLicense extends LegacyService {
return [ return [
{ {
title: 'CRAN/METACRAN', title: 'CRAN/METACRAN',
previewUrl: 'devtools', namedParams: { packageName: 'devtools' },
staticPreview: {
label: 'license',
message: 'GPL (>= 2)',
color: 'blue',
},
keywords: ['R'], keywords: ['R'],
}, },
] ]

View File

@@ -17,6 +17,7 @@ class DubVersion extends LegacyService {
static get route() { static get route() {
return { return {
base: 'dub/v', base: 'dub/v',
pattern: ':packageName',
} }
} }
@@ -24,8 +25,8 @@ class DubVersion extends LegacyService {
return [ return [
{ {
title: 'DUB', title: 'DUB',
previewUrl: 'vibe-d', namedParams: { packageName: 'vibe-d' },
keywords: ['dub'], staticPreview: { label: 'version', message: 'v0.8.4', color: 'orange' },
}, },
] ]
} }
@@ -41,6 +42,7 @@ class DubLicense extends LegacyService {
static get route() { static get route() {
return { return {
base: 'dub/l', base: 'dub/l',
pattern: ':packageName',
} }
} }
@@ -48,8 +50,8 @@ class DubLicense extends LegacyService {
return [ return [
{ {
title: 'DUB', title: 'DUB',
previewUrl: 'vibe-d', namedParams: { packageName: 'vibe-d' },
keywords: ['dub'], staticPreview: { label: 'license', message: 'MIT', color: 'blue' },
}, },
] ]
} }

View File

@@ -26,7 +26,13 @@ module.exports = class GithubCommitActivity extends LegacyService {
return [ return [
{ {
title: 'GitHub commit activity the past week, 4 weeks, year', title: 'GitHub commit activity the past week, 4 weeks, year',
previewUrl: 'y/eslint/eslint', pattern: 'y/:user/:repo',
namedParams: { user: 'eslint', repo: 'eslint' },
staticPreview: {
label: 'commit activity',
message: '457/year',
color: 'blue',
},
keywords: ['GitHub', 'commit', 'commits', 'activity'], keywords: ['GitHub', 'commit', 'commits', 'activity'],
documentation, documentation,
}, },

View File

@@ -22,8 +22,18 @@ module.exports = class GithubCommitStatus extends LegacyService {
return [ return [
{ {
title: 'GitHub commit merge status', title: 'GitHub commit merge status',
previewUrl: pattern: ':user/:repo/:branch/:commit',
'badges/shields/master/5d4ab86b1b5ddfb3c4a70a70bd19932c52603b8c', namedParams: {
user: 'badges',
repo: 'shields',
branch: 'master',
commit: '5d4ab86b1b5ddfb3c4a70a70bd19932c52603b8c',
},
staticPreview: {
label: 'commits since 3.4.7',
message: '4225',
color: 'blue',
},
keywords: ['GitHub', 'commit', 'branch', 'merge'], keywords: ['GitHub', 'commit', 'branch', 'merge'],
documentation, documentation,
}, },

View File

@@ -8,6 +8,8 @@ const {
} = require('../../lib/badge-data') } = require('../../lib/badge-data')
const { documentation } = require('./github-helpers') const { documentation } = require('./github-helpers')
const keywords = ['GitHub', 'commit']
module.exports = class GithubCommitsSince extends LegacyService { module.exports = class GithubCommitsSince extends LegacyService {
static get category() { static get category() {
return 'activity' return 'activity'
@@ -16,6 +18,7 @@ module.exports = class GithubCommitsSince extends LegacyService {
static get route() { static get route() {
return { return {
base: 'github/commits-since', base: 'github/commits-since',
pattern: ':user/:repo/:version',
} }
} }
@@ -23,14 +26,32 @@ module.exports = class GithubCommitsSince extends LegacyService {
return [ return [
{ {
title: 'GitHub commits', title: 'GitHub commits',
previewUrl: 'SubtitleEdit/subtitleedit/3.4.7', namedParams: {
keywords: ['GitHub', 'commit'], user: 'SubtitleEdit',
repo: 'subtitleedit',
version: '3.4.7',
},
staticPreview: {
label: 'commits since 3.4.7',
message: '4225',
color: 'blue',
},
keywords,
documentation, documentation,
}, },
{ {
title: 'GitHub commits (since latest release)', title: 'GitHub commits (since latest release)',
previewUrl: 'SubtitleEdit/subtitleedit/latest', namedParams: {
keywords: ['GitHub', 'commit'], user: 'SubtitleEdit',
repo: 'subtitleedit',
version: 'latest',
},
staticPreview: {
label: 'commits since 3.5.7',
message: '157',
color: 'blue',
},
keywords,
documentation, documentation,
}, },
] ]

View File

@@ -26,7 +26,16 @@ module.exports = class GithubContributors extends LegacyService {
return [ return [
{ {
title: 'GitHub contributors', title: 'GitHub contributors',
previewUrl: 'contributors/cdnjs/cdnjs', pattern: 'contributors/:user/:repo',
namedParams: {
user: 'cdnjs',
repo: 'cdnjs',
},
staticPreview: {
label: 'contributors',
message: '397',
color: 'blue',
},
keywords: ['GitHub', 'contributor'], keywords: ['GitHub', 'contributor'],
documentation, documentation,
}, },

View File

@@ -26,38 +26,93 @@ module.exports = class GithubDownloads extends LegacyService {
return [ return [
{ {
title: 'GitHub All Releases', title: 'GitHub All Releases',
previewUrl: 'downloads/atom/atom/total', pattern: 'downloads/:user/:repo/total',
keywords: ['github'], namedParams: {
user: 'atom',
repo: 'atom',
},
staticPreview: {
label: 'downloads',
message: '857k total',
color: 'brightgreen',
},
documentation, documentation,
}, },
{ {
title: 'GitHub Releases', title: 'GitHub Releases',
previewUrl: 'downloads/atom/atom/latest/total', pattern: 'downloads/:user/:repo/:tag/total',
keywords: ['github'], namedParams: {
user: 'atom',
repo: 'atom',
tag: 'latest',
},
staticPreview: {
label: 'downloads',
message: '27k',
color: 'brightgreen',
},
documentation, documentation,
}, },
{ {
title: 'GitHub Pre-Releases', title: 'GitHub Pre-Releases',
previewUrl: 'downloads-pre/atom/atom/latest/total', pattern: 'downloads-pre/:user/:repo/:tag/total',
keywords: ['github'], namedParams: {
user: 'atom',
repo: 'atom',
tag: 'latest',
},
staticPreview: {
label: 'downloads',
message: '2k',
color: 'brightgreen',
},
documentation, documentation,
}, },
{ {
title: 'GitHub Releases (by Release)', title: 'GitHub Releases (by Release)',
previewUrl: 'downloads/atom/atom/v0.190.0/total', pattern: 'downloads/:user/:repo/:tag/total',
keywords: ['github'], namedParams: {
user: 'atom',
repo: 'atom',
tag: 'v0.190.0',
},
staticPreview: {
label: 'downloads',
message: '490k v0.190.0',
color: 'brightgreen',
},
documentation, documentation,
}, },
{ {
title: 'GitHub Releases (by Asset)', title: 'GitHub Releases (by Asset)',
previewUrl: 'downloads/atom/atom/latest/atom-amd64.deb', pattern: 'downloads/:user/:repo/:tag/:path*',
keywords: ['github'], namedParams: {
user: 'atom',
repo: 'atom',
tag: 'latest',
path: 'atom-amd64.deb',
},
staticPreview: {
label: 'downloads',
message: '3k [atom-amd64.deb]',
color: 'brightgreen',
},
documentation, documentation,
}, },
{ {
title: 'GitHub Pre-Releases (by Asset)', title: 'GitHub Pre-Releases (by Asset)',
previewUrl: 'downloads-pre/atom/atom/latest/atom-amd64.deb', pattern: 'downloads-pre/:user/:repo/:tag/:path*',
keywords: ['github'], namedParams: {
user: 'atom',
repo: 'atom',
tag: 'latest',
path: 'atom-amd64.deb',
},
staticPreview: {
label: 'downloads',
message: '237 [atom-amd64.deb]',
color: 'brightgreen',
},
documentation, documentation,
}, },
] ]

View File

@@ -25,7 +25,17 @@ module.exports = class GithubFollowers extends LegacyService {
return [ return [
{ {
title: 'GitHub followers', title: 'GitHub followers',
pattern: ':user',
previewUrl: 'espadrine', previewUrl: 'espadrine',
// https://github.com/badges/shields/issues/2479
// namedParams: {
// user: 'espadrine',
// },
// staticPreview: {
// label: 'Follow',
// message: '150',
// style: 'social',
// },
queryParams: { style: 'social', label: 'Follow' }, queryParams: { style: 'social', label: 'Follow' },
documentation, documentation,
}, },

View File

@@ -20,6 +20,7 @@ module.exports = class GithubLicense extends LegacyService {
static get route() { static get route() {
return { return {
base: 'github/license', base: 'github/license',
pattern: ':user/:repo',
} }
} }
@@ -27,7 +28,12 @@ module.exports = class GithubLicense extends LegacyService {
return [ return [
{ {
title: 'GitHub', title: 'GitHub',
previewUrl: 'mashape/apistatus', namedParams: { user: 'mashape', repo: 'apistatus' },
staticExample: {
label: 'license',
message: 'MIT',
color: 'green',
},
keywords: ['GitHub', 'license'], keywords: ['GitHub', 'license'],
documentation, documentation,
}, },

View File

@@ -19,7 +19,17 @@ module.exports = class JiraIssue extends LegacyService {
return [ return [
{ {
title: 'JIRA issue', title: 'JIRA issue',
previewUrl: 'https/issues.apache.org/jira/KAFKA-2896', pattern: ':protocol/:hostAndPath+/:issueKey',
namedParams: {
protocol: 'https',
hostAndPath: 'issues.apache.org/jira',
issueKey: 'KAFKA-2896',
},
staticPreview: {
label: 'kafka-2896',
message: 'Resolved',
color: 'green',
},
}, },
] ]
} }

View File

@@ -27,7 +27,17 @@ module.exports = class JiraSprint extends LegacyService {
return [ return [
{ {
title: 'JIRA sprint completion', title: 'JIRA sprint completion',
previewUrl: 'https/jira.spring.io/94', pattern: ':protocol/:host/:sprintId',
namedParams: {
protocol: 'https',
host: 'jira.spring.io',
sprintId: '94',
},
staticPreview: {
label: 'completion',
message: '96%',
color: 'orange',
},
documentation, documentation,
}, },
] ]

View File

@@ -16,16 +16,18 @@ module.exports = class NpmLicense extends NpmBase {
static get examples() { static get examples() {
return [ return [
{ {
exampleUrl: 'express', title: 'NPM',
pattern: ':package', pattern: ':packageName',
namedParams: { packageName: 'express' },
staticExample: this.render({ licenses: ['MIT'] }), staticExample: this.render({ licenses: ['MIT'] }),
keywords: ['node'], keywords: ['node'],
}, },
{ {
exampleUrl: 'express', title: 'NPM',
pattern: ':package', pattern: ':packageName',
staticExample: this.render({ licenses: ['MIT'] }), namedParams: { packageName: 'express' },
queryParams: { registry_uri: 'https://registry.npmjs.com' }, queryParams: { registry_uri: 'https://registry.npmjs.com' },
staticExample: this.render({ licenses: ['MIT'] }),
keywords: ['node'], keywords: ['node'],
}, },
] ]

View File

@@ -22,7 +22,11 @@ module.exports = class NpmTypeDefinitions extends NpmBase {
return [ return [
{ {
title: 'npm type definitions', title: 'npm type definitions',
previewUrl: 'chalk', pattern: ':packageName',
namedParams: { packageName: 'chalk' },
staticPreview: this.render({
supportedLanguages: ['TypeScript', 'Flow'],
}),
keywords: ['node', 'typescript', 'flow'], keywords: ['node', 'typescript', 'flow'],
}, },
] ]

View File

@@ -11,6 +11,7 @@ module.exports = class PackagistLicense extends LegacyService {
static get route() { static get route() {
return { return {
base: 'packagist/l', base: 'packagist/l',
pattern: ':user/:repo',
} }
} }
@@ -18,7 +19,12 @@ module.exports = class PackagistLicense extends LegacyService {
return [ return [
{ {
title: 'Packagist', title: 'Packagist',
previewUrl: 'doctrine/orm', namedParams: { user: 'doctrine', repo: 'orm' },
staticPreview: {
label: 'license',
message: 'MIT',
color: 'blue',
},
keywords: ['PHP'], keywords: ['PHP'],
}, },
] ]

View File

@@ -5,6 +5,8 @@ const { makeBadgeData: getBadgeData } = require('../../lib/badge-data')
const { checkErrorResponse } = require('../../lib/error-helper') const { checkErrorResponse } = require('../../lib/error-helper')
const { omitv } = require('../../lib/text-formatters') const { omitv } = require('../../lib/text-formatters')
const keywords = ['php', 'runtime']
module.exports = class PhpeyeHhvm extends LegacyService { module.exports = class PhpeyeHhvm extends LegacyService {
static get category() { static get category() {
return 'platform-support' return 'platform-support'
@@ -20,11 +22,29 @@ module.exports = class PhpeyeHhvm extends LegacyService {
return [ return [
{ {
title: 'HHVM', title: 'HHVM',
previewUrl: 'symfony/symfony', pattern: ':user/:packageName',
namedParams: { user: 'symfony', packageName: 'symfony' },
staticPreview: {
label: 'hhvm',
message: 'not tested',
color: 'red',
},
keywords,
}, },
{ {
title: 'HHVM (branch)', title: 'HHVM (branch)',
previewUrl: 'symfony/symfony/master', pattern: ':user/:packageName/:branch',
namedParams: {
user: 'symfony',
packageName: 'symfony',
branch: 'master',
},
staticPreview: {
label: 'hhvm',
message: 'not tested',
color: 'red',
},
keywords,
}, },
] ]
} }

View File

@@ -20,7 +20,9 @@ module.exports = class PypiDjangoVersions extends PypiBase {
return [ return [
{ {
title: 'PyPI - Django Version', title: 'PyPI - Django Version',
previewUrl: 'djangorestframework', pattern: ':packageName',
namedParams: { packageName: 'djangorestframework' },
staticPreview: this.render({ versions: ['1.11', '2.0', '2.1'] }),
keywords: ['python', 'django'], keywords: ['python', 'django'],
}, },
] ]

View File

@@ -20,7 +20,9 @@ module.exports = class PypiImplementation extends PypiBase {
return [ return [
{ {
title: 'PyPI - Implementation', title: 'PyPI - Implementation',
previewUrl: 'Django', pattern: ':packageName',
namedParams: { packageName: 'Django' },
staticPreview: this.render({ implementations: ['cpython'] }),
keywords: ['python'], keywords: ['python'],
}, },
] ]

View File

@@ -17,7 +17,9 @@ module.exports = class PypiLicense extends PypiBase {
return [ return [
{ {
title: 'PyPI - License', title: 'PyPI - License',
previewUrl: 'Django', pattern: ':packageName',
namedParams: { packageName: 'Django' },
staticPreview: { label: 'license', message: 'BSD', color: 'lightgrey' },
keywords: ['python'], keywords: ['python'],
}, },
] ]

View File

@@ -20,7 +20,9 @@ module.exports = class PypiPythonVersions extends PypiBase {
return [ return [
{ {
title: 'PyPI - Python Version', title: 'PyPI - Python Version',
previewUrl: 'Django', pattern: ':packageName',
namedParams: { packageName: 'Django' },
staticPreview: this.render({ versions: ['3.5', '3.6', '3.7'] }),
keywords: ['python'], keywords: ['python'],
}, },
] ]

View File

@@ -20,7 +20,9 @@ module.exports = class PypiWheel extends PypiBase {
return [ return [
{ {
title: 'PyPI - Wheel', title: 'PyPI - Wheel',
previewUrl: 'Django', pattern: ':packageName',
namedParams: { packageName: 'Django' },
staticPreview: this.render({ hasWheel: true }),
keywords: ['python'], keywords: ['python'],
}, },
] ]

View File

@@ -15,7 +15,7 @@ module.exports = class Waffle extends LegacyService {
static get route() { static get route() {
return { return {
base: 'waffle', base: 'waffle/label',
} }
} }
@@ -23,7 +23,17 @@ module.exports = class Waffle extends LegacyService {
return [ return [
{ {
title: 'Waffle.io', title: 'Waffle.io',
previewUrl: 'label/evancohen/smart-mirror/status%3A%20in%20progress', pattern: ':user/:repo/:query',
namedParams: {
user: 'evancohen',
repo: 'smart-mirror',
query: 'status: in progress',
},
staticPreview: {
label: 'status: in progress',
message: '2',
color: '000',
},
}, },
] ]
} }

View File

@@ -1,11 +1,9 @@
'use strict' 'use strict'
const Joi = require('joi') const Joi = require('joi')
const ServiceTester = require('../service-tester')
const { invalidJSON } = require('../response-fixtures') const { invalidJSON } = require('../response-fixtures')
const t = new ServiceTester({ id: 'waffle', title: 'Waffle.io' }) const t = (module.exports = require('../create-service-tester')())
module.exports = t
const fakeData = [ const fakeData = [
{ {
@@ -34,7 +32,7 @@ const fakeData = [
t.create( t.create(
'label should be `bug` & value should be exactly 5 as supplied in `fakeData`. e.g: bug|5' 'label should be `bug` & value should be exactly 5 as supplied in `fakeData`. e.g: bug|5'
) )
.get('/label/userName/repoName/bug.json?style=_shields_test') .get('/userName/repoName/bug.json?style=_shields_test')
.intercept(nock => .intercept(nock =>
nock('https://api.waffle.io/') nock('https://api.waffle.io/')
.get('/userName/repoName/columns?with=count') .get('/userName/repoName/columns?with=count')
@@ -47,7 +45,7 @@ t.create(
}) })
t.create('label should be `Mybug` & value should be formated. e.g: Mybug|25') t.create('label should be `Mybug` & value should be formated. e.g: Mybug|25')
.get('/label/ritwickdey/vscode-live-server/bug.json?label=Mybug') .get('/ritwickdey/vscode-live-server/bug.json?label=Mybug')
.expectJSONTypes( .expectJSONTypes(
Joi.object().keys({ Joi.object().keys({
name: 'Mybug', name: 'Mybug',
@@ -58,7 +56,7 @@ t.create('label should be `Mybug` & value should be formated. e.g: Mybug|25')
) )
t.create('label (repo not found)') t.create('label (repo not found)')
.get('/label/not-a-user/not-a-repo/bug.json') .get('/not-a-user/not-a-repo/bug.json')
.expectJSON({ .expectJSON({
name: 'waffle', name: 'waffle',
value: 'not found', value: 'not found',
@@ -66,7 +64,7 @@ t.create('label (repo not found)')
t.create('label (label not found)') t.create('label (label not found)')
.get( .get(
'/label/ritwickdey/vscode-live-server/not-a-real-label.json?style=_shields_test' '/ritwickdey/vscode-live-server/not-a-real-label.json?style=_shields_test'
) )
.expectJSON({ .expectJSON({
name: 'not-a-real-label', name: 'not-a-real-label',
@@ -75,7 +73,7 @@ t.create('label (label not found)')
}) })
t.create('label (empty response)') t.create('label (empty response)')
.get('/label/userName/repoName/bug.json') .get('/userName/repoName/bug.json')
.intercept(nock => .intercept(nock =>
nock('https://api.waffle.io/') nock('https://api.waffle.io/')
.get('/userName/repoName/columns?with=count') .get('/userName/repoName/columns?with=count')
@@ -87,12 +85,12 @@ t.create('label (empty response)')
}) })
t.create('label (connection error)') t.create('label (connection error)')
.get('/label/ritwickdey/vscode-live-server/bug.json') .get('/ritwickdey/vscode-live-server/bug.json')
.networkOff() .networkOff()
.expectJSON({ name: 'waffle', value: 'inaccessible' }) .expectJSON({ name: 'waffle', value: 'inaccessible' })
t.create('label (unexpected response)') t.create('label (unexpected response)')
.get('/label/userName/repoName/bug.json') .get('/userName/repoName/bug.json')
.intercept(nock => .intercept(nock =>
nock('https://api.waffle.io/') nock('https://api.waffle.io/')
.get('/userName/repoName/columns?with=count') .get('/userName/repoName/columns?with=count')