From 02798484ff4af6794d19cd43e6a86c33e5a87e3f Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 13 Feb 2018 17:54:58 +0000 Subject: [PATCH] use invalid json fixture --- service-tests/chocolatey.js | 7 ++++--- service-tests/powershellgallery.js | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/service-tests/chocolatey.js b/service-tests/chocolatey.js index 600e5900d4cb5..c5f1a856e75ff 100644 --- a/service-tests/chocolatey.js +++ b/service-tests/chocolatey.js @@ -12,6 +12,7 @@ const { versionJsonFirstCharZero, versionJsonFirstCharNotZero } = require('./helpers/nuget-fixtures.js'); +const { invalidJSON } = require('./helpers/response-fixtures'); const t = new ServiceTester({ id: 'chocolatey', title: 'Chocolatey' }); module.exports = t; @@ -39,7 +40,7 @@ t.create('total downloads (unexpected response)') .get('/dt/scriptcs.json') .intercept(nock => nock('https://www.chocolatey.org') .get("/api/v2/Packages()?$filter=Id%20eq%20%27scriptcs%27%20and%20IsLatestVersion%20eq%20true") - .reply(200, "{{{{{invalid json}}") + .reply(invalidJSON) ) .expectJSON({name: 'chocolatey', value: 'invalid'}); @@ -102,7 +103,7 @@ t.create('version (unexpected response)') .get('/v/scriptcs.json') .intercept(nock => nock('https://www.chocolatey.org') .get("/api/v2/Packages()?$filter=Id%20eq%20%27scriptcs%27%20and%20IsLatestVersion%20eq%20true") - .reply(200, "{{{{{invalid json}}") + .reply(invalidJSON) ) .expectJSON({name: 'chocolatey', value: 'invalid'}); @@ -165,6 +166,6 @@ t.create('version (pre) (unexpected response)') .get('/vpre/scriptcs.json') .intercept(nock => nock('https://www.chocolatey.org') .get("/api/v2/Packages()?$filter=Id%20eq%20%27scriptcs%27%20and%20IsAbsoluteLatestVersion%20eq%20true") - .reply(200, "{{{{{invalid json}}") + .reply(invalidJSON) ) .expectJSON({name: 'chocolatey', value: 'invalid'}); diff --git a/service-tests/powershellgallery.js b/service-tests/powershellgallery.js index e4464eab0f464..db3b3122fdaf9 100644 --- a/service-tests/powershellgallery.js +++ b/service-tests/powershellgallery.js @@ -12,6 +12,7 @@ const { versionJsonFirstCharZero, versionJsonFirstCharNotZero } = require('./helpers/nuget-fixtures.js'); +const { invalidJSON } = require('./helpers/response-fixtures'); const t = new ServiceTester({ id: 'powershellgallery', title: 'PowerShell Gallery' }); module.exports = t; @@ -39,7 +40,7 @@ t.create('total downloads (unexpected response)') .get('/dt/ACMESharp.json') .intercept(nock => nock('https://www.powershellgallery.com') .get("/api/v2/Packages()?$filter=Id%20eq%20%27ACMESharp%27%20and%20IsLatestVersion%20eq%20true") - .reply(200, "{{{{{invalid json}}") + .reply(invalidJSON) ) .expectJSON({name: 'powershellgallery', value: 'invalid'}); @@ -102,7 +103,7 @@ t.create('version (unexpected response)') .get('/v/ACMESharp.json') .intercept(nock => nock('https://www.powershellgallery.com') .get("/api/v2/Packages()?$filter=Id%20eq%20%27ACMESharp%27%20and%20IsLatestVersion%20eq%20true") - .reply(200, "{{{{{invalid json}}") + .reply(invalidJSON) ) .expectJSON({name: 'powershellgallery', value: 'invalid'}); @@ -165,6 +166,6 @@ t.create('version (pre) (unexpected response)') .get('/vpre/ACMESharp.json') .intercept(nock => nock('https://www.powershellgallery.com') .get("/api/v2/Packages()?$filter=Id%20eq%20%27ACMESharp%27%20and%20IsAbsoluteLatestVersion%20eq%20true") - .reply(200, "{{{{{invalid json}}") + .reply(invalidJSON) ) .expectJSON({name: 'powershellgallery', value: 'invalid'});