drawBorder.js
1.95 KB
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
68
69
70
71
/* eslint-disable sort-keys */
import {
expect
} from 'chai';
import {
drawBorder,
drawBorderTop,
drawBorderJoin,
drawBorderBottom
} from './../src/drawBorder';
describe('drawBorder', () => {
it('draws a border using parts', () => {
const parts = {
left: '╔',
right: '╗',
body: '═',
join: '╤'
};
expect(drawBorder([1], parts)).to.equal('╔═╗\n');
expect(drawBorder([1, 1], parts)).to.equal('╔═╤═╗\n');
expect(drawBorder([5, 10], parts)).to.equal('╔═════╤══════════╗\n');
});
});
describe('drawBorderTop', () => {
it('draws a border using parts', () => {
const parts = {
topLeft: '╔',
topRight: '╗',
topBody: '═',
topJoin: '╤'
};
expect(drawBorderTop([1], parts)).to.equal('╔═╗\n');
expect(drawBorderTop([1, 1], parts)).to.equal('╔═╤═╗\n');
expect(drawBorderTop([5, 10], parts)).to.equal('╔═════╤══════════╗\n');
});
});
describe('drawBorderJoin', () => {
it('draws a border using parts', () => {
const parts = {
joinBody: '─',
joinLeft: '╟',
joinRight: '╢',
joinJoin: '┼'
};
expect(drawBorderJoin([1], parts)).to.equal('╟─╢\n');
expect(drawBorderJoin([1, 1], parts)).to.equal('╟─┼─╢\n');
expect(drawBorderJoin([5, 10], parts)).to.equal('╟─────┼──────────╢\n');
});
});
describe('drawBorderBottom', () => {
it('draws a border using parts', () => {
const parts = {
bottomBody: '═',
bottomJoin: '╧',
bottomLeft: '╚',
bottomRight: '╝'
};
expect(drawBorderBottom([1], parts)).to.equal('╚═╝\n');
expect(drawBorderBottom([1, 1], parts)).to.equal('╚═╧═╝\n');
expect(drawBorderBottom([5, 10], parts)).to.equal('╚═════╧══════════╝\n');
});
});