Skip to content

Commit

Permalink
Apply 'standard' auto-fixes to remainder of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pjohnmeyer authored and isaacs committed Oct 12, 2018
1 parent 42e765b commit b30f2ce
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 142 deletions.
56 changes: 28 additions & 28 deletions test/clean.js
Original file line number Diff line number Diff line change
@@ -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()
})
36 changes: 18 additions & 18 deletions test/coerce.js
Original file line number Diff line number Diff line change
@@ -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',
Expand Down Expand Up @@ -88,19 +88,19 @@ 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'],
[r('1')(16) + '.2.3.4', r('1')(16) + '.2.3'],
['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']
Expand All @@ -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()
})
48 changes: 24 additions & 24 deletions test/gtr.js
Original file line number Diff line number Diff line change
@@ -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
[
Expand Down Expand Up @@ -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
[
Expand Down Expand Up @@ -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()
})
48 changes: 24 additions & 24 deletions test/ltr.js
Original file line number Diff line number Diff line change
@@ -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
[
Expand Down Expand Up @@ -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
[
Expand Down Expand Up @@ -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()
})
66 changes: 33 additions & 33 deletions test/major-minor-patch.js
Original file line number Diff line number Diff line change
@@ -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
[
Expand All @@ -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
[
Expand All @@ -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
[
Expand All @@ -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()
})
30 changes: 15 additions & 15 deletions test/prerelease.js
Original file line number Diff line number Diff line change
@@ -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'],
Expand All @@ -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()
})

0 comments on commit b30f2ce

Please sign in to comment.