UNPKG

1.24 kBJavaScriptView Raw
1var should = require('should');
2var tags = require('../lib/tags');
3
4describe('Tags', function() {
5 describe('.isValid()', function() {
6 it('should return true for version >= 2.0.0', function() {
7 tags.isValid('2.0.0').should.be.ok()
8 });
9
10 it('should return true for pre-releases', function() {
11 tags.isValid('2.0.0-beta.0').should.be.ok()
12 });
13 });
14
15 describe('.satisfies()', function() {
16 it('should return true for tag and *', function() {
17 tags.satisfies('pre', '*').should.be.ok()
18 });
19 });
20
21 describe('.sort()', function() {
22 it('should sort tags first', function() {
23 tags.sort('pre', '1.0.0').should.equal(-1);
24 tags.sort('beta', '1.0.0').should.equal(-1);
25 tags.sort('alpha', '1.0.0').should.equal(-1);
26 });
27
28 it('should sort tags correctly', function() {
29 tags.sort('alpha', 'pre').should.equal(-1);
30 tags.sort('alpha', 'beta').should.equal(-1);
31 });
32
33 it('should sort pre versions first', function() {
34 tags.sort('1.0.0-pre.1', '0.0.9').should.equal(-1);
35 tags.sort('1.0.0-pre.1', '1.0.0').should.equal(1);
36 });
37 });
38});