-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegulf.test.ts
48 lines (44 loc) · 1.17 KB
/
codegulf.test.ts
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
import CodeGulf from './code-golf'
describe('Move table headings to the left', () => {
it('convert table with same amount of columns', () => {
const expected = [
["a", 1, "-", "@"],
["b", 2, "-", "#"],
["c", 3, "-", "$"],
["d", 4, "-", "%"]
]
const table = [
["a", "b", "c", "d"],
["1", "2", "3", "4"],
["-", "-", "-", "-"],
["@", "#", "$", "%"]
]
expect(CodeGulf.convert(table)).toEqual(expected)
})
xit('convert table with differing amount of columns', () => {
const expected = [
["a", 1, "-", "@"],
["b", 2, "-", "$"],
["c", 3, "-"],
["d"]
]
const table = [
["a", "b", "c", "d"],
["1", "2", "3"],
["-", "-", "-"],
["@", "$"]
]
expect(CodeGulf.convert(table)).toEqual(expected)
})
xit('Throws error when any column that is not the last don\'t have the correct amount of data', () => {
const table = [
["a", "b", "c", "d"],
["1", "2", "3"],
["-", "-", "-", "-"],
["@", "#", "$", "%"]
]
expect(() => CodeGulf.convert(table)).toThrowError(
'The columns dont have the same amount of data'
)
})
})