-
Notifications
You must be signed in to change notification settings - Fork 453
/
Copy pathprotocol.js
31 lines (29 loc) · 1.13 KB
/
protocol.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var protocol = require('../lib/protocol');
var expect = require('chai').expect;
describe('protocol', function() {
describe('checkAtLeast', function() {
var FIXTURES = [
['1.0', '1.0', true],
['1.1', '1.0', true],
['1.0', '1.1', false],
['1.0', '1', true],
['1.10', '1.3', true],
['2.0', '1.3', true],
[{major: 1, minor: 0}, {major: 1, minor: 0}, true],
[{major: 1, minor: 1}, {major: 1, minor: 0}, true],
[{major: 1, minor: 0}, {major: 1, minor: 1}, false],
[{protocol: 1, protocolMinor: 0}, {protocol: 1, protocolMinor: 0}, true],
[{protocol: 1, protocolMinor: 1}, {protocol: 1, protocolMinor: 0}, true],
[{protocol: 1, protocolMinor: 0}, {protocol: 1, protocolMinor: 1}, false],
[{}, '1.0', false],
['', '1.0', false]
];
FIXTURES.forEach(function(fixture) {
var is = fixture[2] ? ' is ' : ' is not ';
var name = 'checks ' + JSON.stringify(fixture[0]) + is + 'at least ' + JSON.stringify(fixture[1]);
it(name, function() {
expect(protocol.checkAtLeast(fixture[0], fixture[1])).to.equal(fixture[2]);
});
});
});
});