Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80682 views
1
2
/**
3
* Module requirements.
4
*/
5
6
require('./common');
7
8
var Table = require('cli-table');
9
10
/**
11
* Tests.
12
*/
13
14
module.exports = {
15
16
'test complete table': function (){
17
var table = new Table({
18
head: ['Rel', 'Change', 'By', 'When']
19
, style: {
20
'padding-left': 1
21
, 'padding-right': 1
22
}
23
, colWidths: [6, 21, 25, 17]
24
});
25
26
table.push(
27
['v0.1', 'Testing something cool', '[email protected]', '7 minutes ago']
28
, ['v0.1', 'Testing something cool', '[email protected]', '8 minutes ago']
29
);
30
31
var expected = [
32
'┏━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓'
33
, '┃ Rel ┃ Change ┃ By ┃ When ┃'
34
, '┣━━━━━━╋━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━┫'
35
, '┃ v0.1 ┃ Testing something … ┃ [email protected] ┃ 7 minutes ago ┃'
36
, '┣━━━━━━╋━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━┫'
37
, '┃ v0.1 ┃ Testing something … ┃ [email protected] ┃ 8 minutes ago ┃'
38
, '┗━━━━━━┻━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┛'
39
];
40
41
table.toString().should.eql(expected.join("\n"));
42
},
43
44
'test width property': function (){
45
var table = new Table({
46
head: ['Cool']
47
});
48
49
table.width.should.eql(8);
50
}
51
52
};
53
54