From 43d99f96e62c021cc55bacb35a35ef6539971d58 Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Wed, 28 Nov 2018 18:54:04 -0500 Subject: [PATCH] Fix failing service tests for [bintray npmlicense github crates] (#2401) Closes #2343 #2348 #2402 Ref: #2345 #1359 --- services/bintray/bintray.tester.js | 10 +++++----- services/crates/crates-license.tester.js | 18 ++++++++++++++++++ services/crates/crates.tester.js | 14 -------------- services/github/github.tester.js | 4 ++-- services/npm/npm-license.tester.js | 2 +- 5 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 services/crates/crates-license.tester.js delete mode 100644 services/crates/crates.tester.js diff --git a/services/bintray/bintray.tester.js b/services/bintray/bintray.tester.js index dd5f8c98ce05d..91b7eb0adb542 100644 --- a/services/bintray/bintray.tester.js +++ b/services/bintray/bintray.tester.js @@ -1,12 +1,12 @@ 'use strict' const Joi = require('joi') -const createServiceTester = require('../create-service-tester') const { colorScheme } = require('../test-helpers') -const { isVPlusDottedVersionNClauses } = require('../test-validators') - -const t = createServiceTester() +const { + isVPlusDottedVersionNClausesWithOptionalSuffix, +} = require('../test-validators') +const t = require('../create-service-tester')() module.exports = t t.create('version') @@ -14,7 +14,7 @@ t.create('version') .expectJSONTypes( Joi.object().keys({ name: 'bintray', - value: isVPlusDottedVersionNClauses, + value: isVPlusDottedVersionNClausesWithOptionalSuffix, }) ) diff --git a/services/crates/crates-license.tester.js b/services/crates/crates-license.tester.js new file mode 100644 index 0000000000000..1419799d1f7da --- /dev/null +++ b/services/crates/crates-license.tester.js @@ -0,0 +1,18 @@ +'use strict' + +const ServiceTester = require('../service-tester') + +const t = new ServiceTester({ + id: 'crates', + title: 'crates.io', + pathPrefix: '/crates/l', +}) +module.exports = t + +t.create('license') + .get('/libc.json') + .expectJSON({ name: 'license', value: 'MIT OR Apache-2.0' }) + +t.create('license (with version)') + .get('/libc/0.2.31.json') + .expectJSON({ name: 'license', value: 'MIT OR Apache-2.0' }) diff --git a/services/crates/crates.tester.js b/services/crates/crates.tester.js deleted file mode 100644 index dc33a5ec744ff..0000000000000 --- a/services/crates/crates.tester.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -const ServiceTester = require('../service-tester') - -const t = new ServiceTester({ id: 'crates', title: 'crates.io' }) -module.exports = t - -t.create('license') - .get('/l/libc.json') - .expectJSON({ name: 'license', value: 'MIT/Apache-2.0' }) - -t.create('license (with version)') - .get('/l/libc/0.2.31.json') - .expectJSON({ name: 'license', value: 'MIT/Apache-2.0' }) diff --git a/services/github/github.tester.js b/services/github/github.tester.js index 469637d4c6b82..dd3921bdb020c 100644 --- a/services/github/github.tester.js +++ b/services/github/github.tester.js @@ -484,11 +484,11 @@ t.create('Package version (repo not found)') t.create('Package name') .get('/package-json/n/badges/shields.json') - .expectJSON({ name: 'package name', value: 'gh-badges' }) + .expectJSON({ name: 'package name', value: 'shields.io' }) t.create('Package name - Custom label') .get('/package-json/name/badges/shields.json?label=Dev Name') - .expectJSON({ name: 'Dev Name', value: 'gh-badges' }) + .expectJSON({ name: 'Dev Name', value: 'shields.io' }) t.create('Package array') .get('/package-json/keywords/badges/shields.json') diff --git a/services/npm/npm-license.tester.js b/services/npm/npm-license.tester.js index c759eea26f68b..a221803517501 100644 --- a/services/npm/npm-license.tester.js +++ b/services/npm/npm-license.tester.js @@ -80,7 +80,7 @@ t.create('license for package with a license array') .expectJSON({ name: 'license', value: 'MPL-2.0, MIT', - colorB: colorsB.lightgrey, + colorB: colorsB.green, }) t.create('license for unknown package')