Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [node npm] service has bad colors #4809 #4810

Merged
merged 17 commits into from
Apr 5, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 99 additions & 33 deletions services/node/node-current.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,98 +13,164 @@ function expectSemverRange(message) {
expect(() => new Range(message)).not.to.throw()
}

regevbr marked this conversation as resolved.
Show resolved Hide resolved
t.create('engines satisfies current node version')
t.create('gets the node version of passport - live')
regevbr marked this conversation as resolved.
Show resolved Hide resolved
.get('/passport.json')
.intercept(mockPackageData(`passport`, `>=0.4.0`))
.intercept(mockCurrentSha(13))
.expectBadge({ label: 'node', message: `>=0.4.0`, color: `brightgreen` })
.expectBadge({ label: 'node' })
.afterJSON(json => {
expectSemverRange(json.message)
})

t.create('engines satisfies current node version')
.get('/passport.json')
.intercept(
mockPackageData({
packageName: 'passport',
engines: '>=0.4.0',
})
)
.intercept(mockCurrentSha(13))
.expectBadge({ label: 'node', message: `>=0.4.0`, color: `brightgreen` })

t.create('engines not satisfies current node version')
calebcartwright marked this conversation as resolved.
Show resolved Hide resolved
.get('/passport.json')
.intercept(mockPackageData(`passport`, `12`))
.intercept(
mockPackageData({
packageName: 'passport',
engines: '12',
})
)
.intercept(mockCurrentSha(13))
.expectBadge({ label: 'node', message: `12`, color: `yellow` })

t.create('gets the node version of @stdlib/stdlib - live')
.get('/@stdlib/stdlib.json')
.expectBadge({ label: 'node' })
.afterJSON(json => {
expectSemverRange(json.message)
})

t.create('engines satisfies current node version - scoped')
.get('/@stdlib/stdlib.json')
.intercept(mockPackageData(`stdlib`, `>=0.4.0`, `@stdlib`))
.intercept(
mockPackageData({
packageName: 'stdlib',
engines: '>=0.4.0',
scope: '@stdlib',
tag: '',
registry: '',
})
)
.intercept(mockCurrentSha(13))
.expectBadge({ label: 'node', message: `>=0.4.0`, color: `brightgreen` })
.afterJSON(json => {
expectSemverRange(json.message)
})

t.create('engines not satisfies current node version - scoped')
calebcartwright marked this conversation as resolved.
Show resolved Hide resolved
.get('/@stdlib/stdlib.json')
.intercept(mockPackageData(`stdlib`, `12`, `@stdlib`))
.intercept(
mockPackageData({
packageName: 'stdlib',
engines: '12',
scope: '@stdlib',
tag: '',
registry: '',
})
)
.intercept(mockCurrentSha(13))
.expectBadge({ label: 'node', message: `12`, color: `yellow` })

t.create("gets the tagged release's node version version of ionic - live")
.get('/ionic/testing.json')
.expectBadge({ label: 'node@testing' })
.afterJSON(json => {
expectSemverRange(json.message)
})

t.create('engines satisfies current node version - tagged')
.get('/ionic/next.json')
.intercept(mockPackageData(`ionic`, `>=0.4.0`, undefined, `next`))
.get('/ionic/testing.json')
.intercept(
mockPackageData({
packageName: 'ionic',
engines: '>=0.4.0',
tag: 'testing',
})
)
.intercept(mockCurrentSha(13))
.expectBadge({ label: 'node@next', message: `>=0.4.0`, color: `brightgreen` })
.afterJSON(json => {
expectSemverRange(json.message)
.expectBadge({
label: 'node@testing',
message: `>=0.4.0`,
color: `brightgreen`,
})

t.create('engines not satisfies current node version - tagged')
calebcartwright marked this conversation as resolved.
Show resolved Hide resolved
.get('/ionic/next.json')
.intercept(mockPackageData(`ionic`, `12`, undefined, `next`))
.get('/ionic/testing.json')
.intercept(
mockPackageData({
packageName: 'ionic',
engines: '12',
tag: 'testing',
})
)
.intercept(mockCurrentSha(13))
.expectBadge({ label: 'node@next', message: `12`, color: `yellow` })
.expectBadge({ label: 'node@testing', message: `12`, color: `yellow` })

t.create("gets the tagged release's node version of @cycle/core - live")
.get('/@cycle/core/canary.json')
.expectBadge({ label: 'node@canary' })
.afterJSON(json => {
expectSemverRange(json.message)
})

t.create('engines satisfies current node version - scoped and tagged')
.get('/@cycle/core/canary.json')
.intercept(mockPackageData(`core`, `>=0.4.0`, `@cycle`, `canary`))
.intercept(
mockPackageData({
packageName: 'core',
engines: '>=0.4.0',
scope: '@cycle',
tag: 'canary',
})
)
.intercept(mockCurrentSha(13))
.expectBadge({
label: 'node@canary',
message: `>=0.4.0`,
color: `brightgreen`,
})
.afterJSON(json => {
expectSemverRange(json.message)
})

t.create('engines not satisfies current node version - scoped and tagged')
calebcartwright marked this conversation as resolved.
Show resolved Hide resolved
.get('/@cycle/core/canary.json')
.intercept(mockPackageData(`core`, `12`, `@cycle`, `canary`))
.intercept(
mockPackageData({
packageName: 'core',
engines: '12',
scope: '@cycle',
tag: 'canary',
})
)
.intercept(mockCurrentSha(13))
.expectBadge({ label: 'node@canary', message: `12`, color: `yellow` })

t.create('gets the node version of passport from a custom registry - live')
.get('/passport.json?registry_uri=https://registry.npmjs.com')
.expectBadge({ label: 'node' })
.afterJSON(json => {
expectSemverRange(json.message)
})

t.create('engines satisfies current node version with custom registry')
regevbr marked this conversation as resolved.
Show resolved Hide resolved
.get('/passport.json?registry_uri=https://registry.npmjs.com')
.intercept(
mockPackageData(
`passport`,
`>=0.4.0`,
undefined,
undefined,
'https://registry.npmjs.com'
)
mockPackageData({
packageName: 'passport',
engines: '>=0.4.0',
registry: 'https://registry.npmjs.com',
})
)
.intercept(mockCurrentSha(13))
.expectBadge({ label: 'node', message: `>=0.4.0`, color: `brightgreen` })
.afterJSON(json => {
expectSemverRange(json.message)
})

t.create('invalid package name - live')
.get('/frodo-is-not-a-package.json')
.expectBadge({ label: 'node', message: 'package not found' })

t.create('invalid package name')
.get('/frodo-is-not-a-package.json')
Expand Down
2 changes: 1 addition & 1 deletion services/node/node-lts.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = class NodeLtsVersion extends NodeVersionBase {
}

regevbr marked this conversation as resolved.
Show resolved Hide resolved
static get defaultBadgeData() {
return { label: 'node lts' }
return { label: 'node-lts' }
regevbr marked this conversation as resolved.
Show resolved Hide resolved
}

static get type() {
Expand Down
2 changes: 1 addition & 1 deletion services/node/node-lts.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { test, given } = require('sazerac')
const NodeVersion = require('./node-lts.service')

describe('node lts renderStaticPreview', function() {
describe('node-lts renderStaticPreview', function() {
it('should have parity with render()', async function() {
const nodeVersionRange = '>= 6.0.0'

Expand Down
Loading