From b30f2ce1f6adfe5c4f14eb69b034bc8a4c05b82a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 12 Oct 2018 11:20:20 -0500 Subject: [PATCH] Apply 'standard' auto-fixes to remainder of tests --- test/clean.js | 56 ++++++++++++++++----------------- test/coerce.js | 36 ++++++++++----------- test/gtr.js | 48 ++++++++++++++-------------- test/ltr.js | 48 ++++++++++++++-------------- test/major-minor-patch.js | 66 +++++++++++++++++++-------------------- test/prerelease.js | 30 +++++++++--------- 6 files changed, 142 insertions(+), 142 deletions(-) diff --git a/test/clean.js b/test/clean.js index 9e268de9..d48c149e 100644 --- a/test/clean.js +++ b/test/clean.js @@ -1,29 +1,29 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); -var clean = semver.clean; +var tap = require('tap') +var test = tap.test +var semver = require('../semver.js') +var clean = semver.clean -test('\nclean tests', function(t) { - // [range, version] - // Version should be detectable despite extra characters - [ - ['1.2.3', '1.2.3'], - [' 1.2.3 ', '1.2.3'], - [' 1.2.3-4 ', '1.2.3-4'], - [' 1.2.3-pre ', '1.2.3-pre'], - [' =v1.2.3 ', '1.2.3'], - ['v1.2.3', '1.2.3'], - [' v1.2.3 ', '1.2.3'], - ['\t1.2.3', '1.2.3'], - ['>1.2.3', null], - ['~1.2.3', null], - ['<=1.2.3', null], - ['1.2.x', null] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var msg = 'clean(' + range + ') = ' + version; - t.equal(clean(range), version, msg); - }); - t.end(); -}); +test('\nclean tests', function (t) { + // [range, version] + // Version should be detectable despite extra characters + [ + ['1.2.3', '1.2.3'], + [' 1.2.3 ', '1.2.3'], + [' 1.2.3-4 ', '1.2.3-4'], + [' 1.2.3-pre ', '1.2.3-pre'], + [' =v1.2.3 ', '1.2.3'], + ['v1.2.3', '1.2.3'], + [' v1.2.3 ', '1.2.3'], + ['\t1.2.3', '1.2.3'], + ['>1.2.3', null], + ['~1.2.3', null], + ['<=1.2.3', null], + ['1.2.x', null] + ].forEach(function (tuple) { + var range = tuple[0] + var version = tuple[1] + var msg = 'clean(' + range + ') = ' + version + t.equal(clean(range), version, msg) + }) + t.end() +}) diff --git a/test/coerce.js b/test/coerce.js index 86a7891b..7673289d 100644 --- a/test/coerce.js +++ b/test/coerce.js @@ -1,21 +1,21 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); -var coerce = semver.coerce; -var valid = semver.valid; +var tap = require('tap') +var test = tap.test +var semver = require('../semver.js') +var coerce = semver.coerce +var valid = semver.valid -function r(text) { +function r (text) { return function (count) { - return text.repeat(count); - }; + return text.repeat(count) + } } -test('\ncoerce tests', function(t) { +test('\ncoerce tests', function (t) { // Expected to be null (cannot be coerced). [ null, - {version: '1.2.3'}, - function () { return '1.2.3'; }, + { version: '1.2.3' }, + function () { return '1.2.3' }, '', '.', 'version one', @@ -88,11 +88,11 @@ test('\ncoerce tests', function(t) { ['1.' + r('2')(17) + '.3.4', '1.0.0'], ['1.2.' + r('3')(17) + '.4', '1.2.0'], [r('1')(17) + '.' + r('2')(16) + '.' + r('3')(16), - r('2')(16) + '.' + r('3')(16) + '.0'], + r('2')(16) + '.' + r('3')(16) + '.0'], [r('1')(16) + '.' + r('2')(17) + '.' + r('3')(16), - r('1')(16) + '.0.0'], + r('1')(16) + '.0.0'], [r('1')(16) + '.' + r('2')(16) + '.' + r('3')(17), - r('1')(16) + '.' + r('2')(16) + '.0'], + r('1')(16) + '.' + r('2')(16) + '.0'], ['11' + r('.1')(126), '11.1.1'], [r('1')(16), r('1')(16) + '.0.0'], ['a' + r('1')(16), r('1')(16) + '.0.0'], @@ -100,7 +100,7 @@ test('\ncoerce tests', function(t) { ['1.' + r('2')(16) + '.3.4', '1.' + r('2')(16) + '.3'], ['1.2.' + r('3')(16) + '.4', '1.2.' + r('3')(16)], [r('1')(16) + '.' + r('2')(16) + '.' + r('3')(16), - r('1')(16) + '.' + r('2')(16) + '.' + r('3')(16)], + r('1')(16) + '.' + r('2')(16) + '.' + r('3')(16)], ['1.2.3.' + r('4')(252) + '.5', '1.2.3'], ['1.2.3.' + r('4')(1024), '1.2.3'], [r('1')(17) + '.4.7.4', '4.7.4'] @@ -109,10 +109,10 @@ test('\ncoerce tests', function(t) { var expected = tuple[1] var msg = 'coerce(' + input + ') should become ' + expected t.same((coerce(input) || {}).version, expected, msg) - }); + }) t.same(valid(coerce('42.6.7.9.3-alpha')), '42.6.7') t.same(valid(coerce('v2')), '2.0.0') - t.done(); -}); + t.done() +}) diff --git a/test/gtr.js b/test/gtr.js index bbb87896..dc3ec833 100644 --- a/test/gtr.js +++ b/test/gtr.js @@ -1,9 +1,9 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); -var gtr = semver.gtr; +var tap = require('tap') +var test = tap.test +var semver = require('../semver.js') +var gtr = semver.gtr -test('\ngtr tests', function(t) { +test('\ngtr tests', function (t) { // [range, version, loose] // Version should be greater than range [ @@ -67,17 +67,17 @@ test('\ngtr tests', function(t) { ['< 1', '1.0.0beta', true], ['=0.7.x', '0.8.2'], ['<0.7.x', '0.7.2'] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'gtr(' + version + ', ' + range + ', ' + loose + ')'; - t.ok(gtr(version, range, loose), msg); - }); - t.end(); -}); + ].forEach(function (tuple) { + var range = tuple[0] + var version = tuple[1] + var loose = tuple[2] || false + var msg = 'gtr(' + version + ', ' + range + ', ' + loose + ')' + t.ok(gtr(version, range, loose), msg) + }) + t.end() +}) -test('\nnegative gtr tests', function(t) { +test('\nnegative gtr tests', function (t) { // [range, version, loose] // Version should NOT be greater than range [ @@ -162,12 +162,12 @@ test('\nnegative gtr tests', function(t) { ['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true], ['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true], ['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = '!gtr(' + version + ', ' + range + ', ' + loose + ')'; - t.notOk(gtr(version, range, loose), msg); - }); - t.end(); -}); + ].forEach(function (tuple) { + var range = tuple[0] + var version = tuple[1] + var loose = tuple[2] || false + var msg = '!gtr(' + version + ', ' + range + ', ' + loose + ')' + t.notOk(gtr(version, range, loose), msg) + }) + t.end() +}) diff --git a/test/ltr.js b/test/ltr.js index 0f7167d6..b6376668 100644 --- a/test/ltr.js +++ b/test/ltr.js @@ -1,9 +1,9 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); -var ltr = semver.ltr; +var tap = require('tap') +var test = tap.test +var semver = require('../semver.js') +var ltr = semver.ltr -test('\nltr tests', function(t) { +test('\nltr tests', function (t) { // [range, version, loose] // Version should be less than range [ @@ -72,17 +72,17 @@ test('\nltr tests', function(t) { ['1', '1.0.0beta', true], ['>=0.7.x', '0.6.2'], ['>1.2.3', '1.3.0-alpha'] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'ltr(' + version + ', ' + range + ', ' + loose + ')'; - t.ok(ltr(version, range, loose), msg); - }); - t.end(); -}); + ].forEach(function (tuple) { + var range = tuple[0] + var version = tuple[1] + var loose = tuple[2] || false + var msg = 'ltr(' + version + ', ' + range + ', ' + loose + ')' + t.ok(ltr(version, range, loose), msg) + }) + t.end() +}) -test('\nnegative ltr tests', function(t) { +test('\nnegative ltr tests', function (t) { // [range, version, loose] // Version should NOT be less than range [ @@ -170,12 +170,12 @@ test('\nnegative ltr tests', function(t) { ['^1.0.0-alpha', '1.0.0-beta'], ['~1.0.0-alpha', '1.0.0-beta'], ['=0.1.0', '1.0.0'] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = '!ltr(' + version + ', ' + range + ', ' + loose + ')'; - t.notOk(ltr(version, range, loose), msg); - }); - t.end(); -}); + ].forEach(function (tuple) { + var range = tuple[0] + var version = tuple[1] + var loose = tuple[2] || false + var msg = '!ltr(' + version + ', ' + range + ', ' + loose + ')' + t.notOk(ltr(version, range, loose), msg) + }) + t.end() +}) diff --git a/test/major-minor-patch.js b/test/major-minor-patch.js index e9d4039c..a074878e 100644 --- a/test/major-minor-patch.js +++ b/test/major-minor-patch.js @@ -1,8 +1,8 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); +var tap = require('tap') +var test = tap.test +var semver = require('../semver.js') -test('\nmajor tests', function(t) { +test('\nmajor tests', function (t) { // [range, version] // Version should be detectable despite extra characters [ @@ -15,17 +15,17 @@ test('\nmajor tests', function(t) { ['\t13.2.3', 13], ['=21.2.3', 21, true], ['v=34.2.3', 34, true] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'major(' + range + ') = ' + version; - t.equal(semver.major(range, loose), version, msg); - }); - t.end(); -}); + ].forEach(function (tuple) { + var range = tuple[0] + var version = tuple[1] + var loose = tuple[2] || false + var msg = 'major(' + range + ') = ' + version + t.equal(semver.major(range, loose), version, msg) + }) + t.end() +}) -test('\nminor tests', function(t) { +test('\nminor tests', function (t) { // [range, version] // Version should be detectable despite extra characters [ @@ -38,17 +38,17 @@ test('\nminor tests', function(t) { ['\t1.13.3', 13], ['=1.21.3', 21, true], ['v=1.34.3', 34, true] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'minor(' + range + ') = ' + version; - t.equal(semver.minor(range, loose), version, msg); - }); - t.end(); -}); + ].forEach(function (tuple) { + var range = tuple[0] + var version = tuple[1] + var loose = tuple[2] || false + var msg = 'minor(' + range + ') = ' + version + t.equal(semver.minor(range, loose), version, msg) + }) + t.end() +}) -test('\npatch tests', function(t) { +test('\npatch tests', function (t) { // [range, version] // Version should be detectable despite extra characters [ @@ -61,12 +61,12 @@ test('\npatch tests', function(t) { ['\t1.2.13', 13], ['=1.2.21', 21, true], ['v=1.2.34', 34, true] - ].forEach(function(tuple) { - var range = tuple[0]; - var version = tuple[1]; - var loose = tuple[2] || false; - var msg = 'patch(' + range + ') = ' + version; - t.equal(semver.patch(range, loose), version, msg); - }); - t.end(); -}); + ].forEach(function (tuple) { + var range = tuple[0] + var version = tuple[1] + var loose = tuple[2] || false + var msg = 'patch(' + range + ') = ' + version + t.equal(semver.patch(range, loose), version, msg) + }) + t.end() +}) diff --git a/test/prerelease.js b/test/prerelease.js index a6df7a63..77c14e40 100644 --- a/test/prerelease.js +++ b/test/prerelease.js @@ -1,9 +1,9 @@ -var tap = require('tap'); -var test = tap.test; -var semver = require('../semver.js'); -var prerelease = semver.prerelease; +var tap = require('tap') +var test = tap.test +var semver = require('../semver.js') +var prerelease = semver.prerelease -test('\nprerelease', function(t) { +test('\nprerelease', function (t) { // [prereleaseParts, version, loose] [ [['alpha', 1], '1.2.2-alpha.1'], @@ -14,13 +14,13 @@ test('\nprerelease', function(t) { [['beta'], '0.6.1beta', true], [null, '1.0.0', true], [null, '~2.0.0-alpha.1', false], - [null, 'invalid version'], - ].forEach(function(tuple) { - var expected = tuple[0]; - var version = tuple[1]; - var loose = tuple[2]; - var msg = 'prerelease(' + version + ')'; - t.same(prerelease(version, loose), expected, msg); - }); - t.end(); -}); + [null, 'invalid version'] + ].forEach(function (tuple) { + var expected = tuple[0] + var version = tuple[1] + var loose = tuple[2] + var msg = 'prerelease(' + version + ')' + t.same(prerelease(version, loose), expected, msg) + }) + t.end() +})