mirror of
https://github.com/badges/shields.git
synced 2025-04-18 19:44:04 +03:00
Remove [Nuget MyGet] color tests (#10654)
This commit is contained in:
parent
8c7872a666
commit
57520a974f
@ -3,12 +3,6 @@ import {
|
||||
isMetric,
|
||||
isVPlusDottedVersionNClausesWithOptionalSuffix,
|
||||
} from '../test-validators.js'
|
||||
import {
|
||||
queryIndex,
|
||||
nuGetV3VersionJsonWithDash,
|
||||
nuGetV3VersionJsonFirstCharZero,
|
||||
nuGetV3VersionJsonFirstCharNotZero,
|
||||
} from '../nuget-fixtures.js'
|
||||
import { invalidJSON } from '../response-fixtures.js'
|
||||
|
||||
export const t = new ServiceTester({
|
||||
@ -75,66 +69,6 @@ t.create('version (tenant)')
|
||||
message: isVPlusDottedVersionNClausesWithOptionalSuffix,
|
||||
})
|
||||
|
||||
t.create('version (yellow badge)')
|
||||
.get('/myget/mongodb/v/MongoDB.Driver.Core.json')
|
||||
.intercept(nock =>
|
||||
nock('https://www.myget.org')
|
||||
.get('/F/mongodb/api/v3/index.json')
|
||||
.reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amongodb.driver.core&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonWithDash),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'mongodb',
|
||||
message: 'v1.2-beta',
|
||||
color: 'yellow',
|
||||
})
|
||||
|
||||
t.create('version (orange badge)')
|
||||
.get('/myget/mongodb/v/MongoDB.Driver.Core.json')
|
||||
.intercept(nock =>
|
||||
nock('https://www.myget.org')
|
||||
.get('/F/mongodb/api/v3/index.json')
|
||||
.reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amongodb.driver.core&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonFirstCharZero),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'mongodb',
|
||||
message: 'v0.35',
|
||||
color: 'orange',
|
||||
})
|
||||
|
||||
t.create('version (blue badge)')
|
||||
.get('/myget/mongodb/v/MongoDB.Driver.Core.json')
|
||||
.intercept(nock =>
|
||||
nock('https://www.myget.org')
|
||||
.get('/F/mongodb/api/v3/index.json')
|
||||
.reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amongodb.driver.core&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonFirstCharNotZero),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'mongodb',
|
||||
message: 'v1.2.7',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
t.create('version (not found)')
|
||||
.get('/myget/foo/v/not-a-real-package.json')
|
||||
.expectBadge({ label: 'myget', message: 'package not found' })
|
||||
@ -148,66 +82,6 @@ t.create('version (pre) (valid)')
|
||||
message: isVPlusDottedVersionNClausesWithOptionalSuffix,
|
||||
})
|
||||
|
||||
t.create('version (pre) (yellow badge)')
|
||||
.get('/myget/mongodb/vpre/MongoDB.Driver.Core.json')
|
||||
.intercept(nock =>
|
||||
nock('https://www.myget.org')
|
||||
.get('/F/mongodb/api/v3/index.json')
|
||||
.reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amongodb.driver.core&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonWithDash),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'mongodb',
|
||||
message: 'v1.2-beta',
|
||||
color: 'yellow',
|
||||
})
|
||||
|
||||
t.create('version (pre) (orange badge)')
|
||||
.get('/myget/mongodb/vpre/MongoDB.Driver.Core.json')
|
||||
.intercept(nock =>
|
||||
nock('https://www.myget.org')
|
||||
.get('/F/mongodb/api/v3/index.json')
|
||||
.reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amongodb.driver.core&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonFirstCharZero),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'mongodb',
|
||||
message: 'v0.35',
|
||||
color: 'orange',
|
||||
})
|
||||
|
||||
t.create('version (pre) (blue badge)')
|
||||
.get('/myget/mongodb/vpre/MongoDB.Driver.Core.json')
|
||||
.intercept(nock =>
|
||||
nock('https://www.myget.org')
|
||||
.get('/F/mongodb/api/v3/index.json')
|
||||
.reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amongodb.driver.core&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonFirstCharNotZero),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'mongodb',
|
||||
message: 'v1.2.7',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
t.create('version (pre) (not found)')
|
||||
.get('/myget/foo/vpre/not-a-real-package.json')
|
||||
.expectBadge({ label: 'myget', message: 'package not found' })
|
||||
|
@ -1,57 +0,0 @@
|
||||
const queryIndex = JSON.stringify({
|
||||
resources: [
|
||||
{
|
||||
'@id': 'https://api-v2v3search-0.nuget.org/query',
|
||||
'@type': 'SearchQueryService',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const nuGetV3VersionJsonWithDash = JSON.stringify({
|
||||
data: [
|
||||
{
|
||||
totalDownloads: 0,
|
||||
versions: [{ version: '1.2-beta' }],
|
||||
},
|
||||
],
|
||||
})
|
||||
const nuGetV3VersionJsonFirstCharZero = JSON.stringify({
|
||||
data: [
|
||||
{
|
||||
totalDownloads: 0,
|
||||
versions: [{ version: '0.35' }],
|
||||
},
|
||||
],
|
||||
})
|
||||
const nuGetV3VersionJsonFirstCharNotZero = JSON.stringify({
|
||||
data: [
|
||||
{
|
||||
totalDownloads: 0,
|
||||
versions: [{ version: '1.2.7' }],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const nuGetV3VersionJsonBuildMetadataWithDash = JSON.stringify({
|
||||
data: [
|
||||
{
|
||||
totalDownloads: 0,
|
||||
versions: [
|
||||
{
|
||||
version: '1.16.0+388',
|
||||
},
|
||||
{
|
||||
version: '1.17.0+1b81349-429',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
export {
|
||||
queryIndex,
|
||||
nuGetV3VersionJsonWithDash,
|
||||
nuGetV3VersionJsonFirstCharZero,
|
||||
nuGetV3VersionJsonFirstCharNotZero,
|
||||
nuGetV3VersionJsonBuildMetadataWithDash,
|
||||
}
|
@ -4,16 +4,35 @@ import {
|
||||
isVPlusDottedVersionNClauses,
|
||||
isVPlusDottedVersionNClausesWithOptionalSuffix,
|
||||
} from '../test-validators.js'
|
||||
import {
|
||||
queryIndex,
|
||||
nuGetV3VersionJsonFirstCharZero,
|
||||
nuGetV3VersionJsonFirstCharNotZero,
|
||||
nuGetV3VersionJsonBuildMetadataWithDash,
|
||||
} from '../nuget-fixtures.js'
|
||||
import { invalidJSON } from '../response-fixtures.js'
|
||||
|
||||
export const t = new ServiceTester({ id: 'nuget', title: 'NuGet' })
|
||||
|
||||
const queryIndex = JSON.stringify({
|
||||
resources: [
|
||||
{
|
||||
'@id': 'https://api-v2v3search-0.nuget.org/query',
|
||||
'@type': 'SearchQueryService',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const nuGetV3VersionJsonBuildMetadataWithDash = JSON.stringify({
|
||||
data: [
|
||||
{
|
||||
totalDownloads: 0,
|
||||
versions: [
|
||||
{
|
||||
version: '1.16.0+388',
|
||||
},
|
||||
{
|
||||
version: '1.17.0+1b81349-429',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// downloads
|
||||
|
||||
t.create('total downloads (valid)')
|
||||
@ -50,59 +69,6 @@ t.create('version (valid)')
|
||||
message: isVPlusDottedVersionNClauses,
|
||||
})
|
||||
|
||||
t.create('version (orange badge)')
|
||||
.get('/v/Microsoft.AspNetCore.Mvc.json')
|
||||
.intercept(nock =>
|
||||
nock('https://api.nuget.org').get('/v3/index.json').reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amicrosoft.aspnetcore.mvc&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonFirstCharZero),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'nuget',
|
||||
message: 'v0.35',
|
||||
color: 'orange',
|
||||
})
|
||||
|
||||
t.create('version (blue badge)')
|
||||
.get('/v/Microsoft.AspNetCore.Mvc.json')
|
||||
.intercept(nock =>
|
||||
nock('https://api.nuget.org').get('/v3/index.json').reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amicrosoft.aspnetcore.mvc&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonFirstCharNotZero),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'nuget',
|
||||
message: 'v1.2.7',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
// https://github.com/badges/shields/issues/4219
|
||||
t.create('version (build metadata with -)')
|
||||
.get('/v/MongoFramework.json')
|
||||
.intercept(nock =>
|
||||
nock('https://api.nuget.org').get('/v3/index.json').reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get('/query?q=packageid%3Amongoframework&prerelease=true&semVerLevel=2')
|
||||
.reply(200, nuGetV3VersionJsonBuildMetadataWithDash),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'nuget',
|
||||
message: 'v1.17.0',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
t.create('version (not found)')
|
||||
.get('/v/not-a-real-package.json')
|
||||
.expectBadge({ label: 'nuget', message: 'package not found' })
|
||||
@ -121,6 +87,23 @@ t.create('version (unexpected second response)')
|
||||
)
|
||||
.expectBadge({ label: 'nuget', message: 'unparseable json response' })
|
||||
|
||||
// https://github.com/badges/shields/issues/4219
|
||||
t.create('version (build metadata with -)')
|
||||
.get('/v/MongoFramework.json')
|
||||
.intercept(nock =>
|
||||
nock('https://api.nuget.org').get('/v3/index.json').reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get('/query?q=packageid%3Amongoframework&prerelease=true&semVerLevel=2')
|
||||
.reply(200, nuGetV3VersionJsonBuildMetadataWithDash),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'nuget',
|
||||
message: 'v1.17.0',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
// version (pre)
|
||||
|
||||
t.create('version (pre) (valid)')
|
||||
@ -130,56 +113,6 @@ t.create('version (pre) (valid)')
|
||||
message: isVPlusDottedVersionNClausesWithOptionalSuffix,
|
||||
})
|
||||
|
||||
t.create('version (pre) (orange badge)')
|
||||
.get('/vpre/Microsoft.AspNetCore.Mvc.json')
|
||||
.intercept(nock =>
|
||||
nock('https://api.nuget.org').get('/v3/index.json').reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amicrosoft.aspnetcore.mvc&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonFirstCharZero),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'nuget',
|
||||
message: 'v0.35',
|
||||
color: 'orange',
|
||||
})
|
||||
|
||||
t.create('version (pre) (blue badge)')
|
||||
.get('/vpre/Microsoft.AspNetCore.Mvc.json')
|
||||
.intercept(nock =>
|
||||
nock('https://api.nuget.org').get('/v3/index.json').reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amicrosoft.aspnetcore.mvc&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(200, nuGetV3VersionJsonFirstCharNotZero),
|
||||
)
|
||||
.expectBadge({
|
||||
label: 'nuget',
|
||||
message: 'v1.2.7',
|
||||
color: 'blue',
|
||||
})
|
||||
|
||||
t.create('version (pre) (not found)')
|
||||
.get('/vpre/not-a-real-package.json')
|
||||
.expectBadge({ label: 'nuget', message: 'package not found' })
|
||||
|
||||
t.create('version (pre) (unexpected second response)')
|
||||
.get('/vpre/Microsoft.AspNetCore.Mvc.json')
|
||||
.intercept(nock =>
|
||||
nock('https://api.nuget.org').get('/v3/index.json').reply(200, queryIndex),
|
||||
)
|
||||
.intercept(nock =>
|
||||
nock('https://api-v2v3search-0.nuget.org')
|
||||
.get(
|
||||
'/query?q=packageid%3Amicrosoft.aspnetcore.mvc&prerelease=true&semVerLevel=2',
|
||||
)
|
||||
.reply(invalidJSON),
|
||||
)
|
||||
.expectBadge({ label: 'nuget', message: 'unparseable json response' })
|
||||
|
Loading…
x
Reference in New Issue
Block a user