Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
var test = require('tape');
|
|
var forEach = require('for-each');
|
|
var semver = require('semver');
|
|
|
|
var getCategory = require('../getCategory');
|
|
var getRange = require('../getRange');
|
|
|
|
var boundaryVersions = require('./versions');
|
|
|
|
test('getCategory', function (t) {
|
|
t['throws'](
|
|
function () { getCategory('not a version'); },
|
|
RangeError,
|
|
'invalid version throws'
|
|
);
|
|
t['throws'](
|
|
function () { getCategory('^1.2.3'); },
|
|
RangeError,
|
|
'semver range throws'
|
|
);
|
|
|
|
t.doesNotThrow(
|
|
function () { getCategory(process.version); },
|
|
'current node version has a category'
|
|
);
|
|
|
|
forEach(boundaryVersions, function (version) {
|
|
t.test('boundary version: ' + version, function (st) {
|
|
st.test('default version', function (s2t) {
|
|
var origVersion = process.version;
|
|
Object.defineProperty(process, 'version', { value: version });
|
|
s2t.teardown(function () { Object.defineProperty(process, 'version', { value: origVersion }); });
|
|
|
|
s2t.equal(
|
|
getCategory(),
|
|
getCategory(version),
|
|
'category with an explicit version matches the defaulted process.version'
|
|
);
|
|
|
|
s2t.end();
|
|
});
|
|
|
|
var range = getRange(getCategory(version));
|
|
st.ok(
|
|
semver.satisfies(version, range),
|
|
'version ' + version + ' satisfies range ' + range
|
|
);
|
|
|
|
st.end();
|
|
});
|
|
});
|
|
|
|
t.end();
|
|
});
|