-
Notifications
You must be signed in to change notification settings - Fork 6
/
test.js
67 lines (56 loc) · 2.54 KB
/
test.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var should = require("should");
var request = require("request");
var BitMask = require('./bit-mask');
var OwnershipMask = BitMask.OwnershipMask;
describe('BitMask', function(){
describe('> OwnershipMask', function(){
var mask;
before(function(){
mask = new OwnershipMask('755');
});
it('user read [1]', function(){
mask.getBit(0).should.equal(mask.hasPermission('user', 'read'));
mask.getBit(0).should.equal(true);
mask.hasPermission('user', 'read').should.equal(true);
});
it('user write [2]', function(){
mask.getBit(1).should.equal(mask.hasPermission('user', 'write'));
mask.getBit(1).should.equal(true);
mask.hasPermission('user', 'write').should.equal(true);
});
it('user execute [3]', function(){
mask.getBit(2).should.equal(mask.hasPermission('user', 'execute'));
mask.getBit(2).should.equal(true);
mask.hasPermission('user', 'execute').should.equal(true);
});
it('group read [4]', function(){
mask.getBit(3).should.equal(mask.hasPermission('group', 'read'));
mask.getBit(3).should.equal(true);
mask.hasPermission('group', 'read').should.equal(true);
});
it('group write [5]', function(){
mask.getBit(4).should.equal(mask.hasPermission('group', 'write'));
mask.getBit(4).should.equal(false);
mask.hasPermission('group', 'write').should.equal(false);
});
it('group execute [6]', function(){
mask.getBit(5).should.equal(mask.hasPermission('group', 'execute'));
mask.getBit(5).should.equal(true);
mask.hasPermission('group', 'execute').should.equal(true);
});
it('world read [7]', function(){
mask.getBit(6).should.equal(mask.hasPermission('world', 'read'));
mask.getBit(6).should.equal(true);
});
it('world write [8]', function(){
mask.getBit(7).should.equal(mask.hasPermission('world', 'write'));
mask.getBit(7).should.equal(false);
mask.hasPermission('world', 'write').should.equal(false);
});
it('world execute [9]', function(){
mask.getBit(8).should.equal(mask.hasPermission('world', 'execute'));
mask.getBit(8).should.equal(true);
mask.hasPermission('world', 'execute').should.equal(true);
});
});
});