@schukai/monster
Version:
Monster is a simple library for creating fast, robust and lightweight websites.
49 lines (35 loc) • 1.13 kB
JavaScript
import {
Version
} from "../../../source/types/version.mjs"
import {expect} from "chai"
describe('Version', function () {
describe('.compareTo()', function () {
[
['1.2.3', '1.2.3', 0],
['1.2.2', '1.2.3', -1],
['2', '2.0.0', 0],
['1.2.4', '1.2.3', 1]
].forEach(function (data) {
let a = data.shift()
let b = data.shift()
let c = data.shift()
it('should return ' + c + ' when the value ' + a + ' is ' + b + '', function () {
expect(new Version(a).compareTo(b)).to.be.equal(c);
});
});
});
describe('.toString()', function () {
[
['1.1.1', '2.3', 3, '1.2.3'],
['1.2.4', '1.2.3', 5, '1.1.5']
].forEach(function (data) {
let a = data.shift()
let b = data.shift()
let c = data.shift()
let d = data.shift()
it('should return ' + d, function () {
expect(new Version(a, b, c).toString()).to.be.equal(d);
});
});
})
});