Skip to content

Commit

Permalink
Remove [Nuget MyGet] color tests (#10654)
Browse files Browse the repository at this point in the history
  • Loading branch information
PyvesB authored Nov 2, 2024
1 parent 8c7872a commit 57520a9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 281 deletions.
126 changes: 0 additions & 126 deletions services/myget/myget.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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' })
Expand All @@ -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' })
57 changes: 0 additions & 57 deletions services/nuget-fixtures.js

This file was deleted.

129 changes: 31 additions & 98 deletions services/nuget/nuget.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
Expand Down Expand Up @@ -50,25 +69,11 @@ 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 (not found)')
.get('/v/not-a-real-package.json')
.expectBadge({ label: 'nuget', message: 'package not found' })

t.create('version (blue badge)')
t.create('version (unexpected second response)')
.get('/v/Microsoft.AspNetCore.Mvc.json')
.intercept(nock =>
nock('https://api.nuget.org').get('/v3/index.json').reply(200, queryIndex),
Expand All @@ -78,13 +83,9 @@ t.create('version (blue badge)')
.get(
'/query?q=packageid%3Amicrosoft.aspnetcore.mvc&prerelease=true&semVerLevel=2',
)
.reply(200, nuGetV3VersionJsonFirstCharNotZero),
.reply(invalidJSON),
)
.expectBadge({
label: 'nuget',
message: 'v1.2.7',
color: 'blue',
})
.expectBadge({ label: 'nuget', message: 'unparseable json response' })

// https://github.com/badges/shields/issues/4219
t.create('version (build metadata with -)')
Expand All @@ -103,24 +104,6 @@ t.create('version (build metadata with -)')
color: 'blue',
})

t.create('version (not found)')
.get('/v/not-a-real-package.json')
.expectBadge({ label: 'nuget', message: 'package not found' })

t.create('version (unexpected second response)')
.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(invalidJSON),
)
.expectBadge({ label: 'nuget', message: 'unparseable json response' })

// version (pre)

t.create('version (pre) (valid)')
Expand All @@ -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' })

0 comments on commit 57520a9

Please sign in to comment.