handle missing statistics array in [VisualStudioMarketplace] badges (#8985)

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
chris48s
2023-03-13 18:42:00 +00:00
committed by GitHub
parent de39ee7aae
commit 46cab5f57b
2 changed files with 30 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ const extensionQuerySchema = Joi.object({
value: Joi.number().required(),
})
)
.required(),
.default([]),
versions: Joi.array()
.items(
Joi.object({

View File

@@ -101,6 +101,35 @@ t.create('zero installs')
color: 'red',
})
t.create('missing statistics array')
.get('/visual-studio-marketplace/i/swellaby.rust-pack.json')
.intercept(nock =>
nock('https://marketplace.visualstudio.com/_apis/public/gallery/')
.post('/extensionquery/')
.reply(200, {
results: [
{
extensions: [
{
versions: [
{
version: '1.0.0',
},
],
releaseDate: '2019-04-13T07:50:27.000Z',
lastUpdated: '2019-04-13T07:50:27.000Z',
},
],
},
],
})
)
.expectBadge({
label: 'installs',
message: '0',
color: 'red',
})
t.create('downloads')
.get('/visual-studio-marketplace/d/swellaby.rust-pack.json')
.intercept(nock =>