Skip to content
Snippets Groups Projects
Commit b01f7e64 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: improve versioning test

parent 39463654
No related merge requests found
......@@ -86,12 +86,11 @@ function getNewValue(currentValue, rangeStrategy, fromVersion, toVersion) {
module.exports = {
...npm,
getNewValue,
isLessThanRange,
isSingleVersion,
isValid,
matches,
maxSatisfyingVersion,
minSatisfyingVersion,
isSingleVersion,
cargo2npm,
getNewValue,
};
const versioning = require('../../lib/versioning');
const supportedSchemes = require('../../lib/config/definitions')
.getOptions()
.find(option => option.name === 'versionScheme').allowedValues;
describe('versioning.get(versionScheme)', () => {
it('should fallback to semver', () => {
......@@ -7,10 +10,17 @@ describe('versioning.get(versionScheme)', () => {
});
it('should return the same interface', () => {
const semverApi = Object.keys(versioning.get('semver'));
const pep440Api = Object.keys(versioning.get('pep440')).concat(
'isLessThanRange'
);
expect(pep440Api.sort()).toEqual(semverApi.sort());
const optionalFunctions = ['isLessThanRange', 'valueToVersion'];
const npmApi = Object.keys(versioning.get('semver'))
.filter(val => !optionalFunctions.includes(val))
.sort();
for (const supportedScheme of supportedSchemes.filter(
scheme => scheme !== 'npm'
)) {
const schemeKeys = Object.keys(versioning.get(supportedScheme))
.filter(val => !optionalFunctions.includes(val))
.sort();
expect(schemeKeys).toEqual(npmApi);
}
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment