-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsolution.spec.ts
69 lines (58 loc) · 1.71 KB
/
solution.spec.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import fn from './solution'
describe('Challenge 12: calculate the total price of the tree by ornaments', () => {
it('Test 01', () => {
const result: number | undefined = fn('***')
const expected: number | undefined = 3
expect(result).toBe(expected)
})
it('Test 02', () => {
const result: number | undefined = fn('*o')
const expected: number | undefined = 4
expect(result).toBe(expected)
})
it('Test 03', () => {
const result: number | undefined = fn('o*')
const expected: number | undefined = 6
expect(result).toBe(expected)
})
it('Test 04', () => {
const result: number | undefined = fn('*o*')
const expected: number | undefined = 5
expect(result).toBe(expected)
})
it('Test 05', () => {
const result: number | undefined = fn('**o*')
const expected: number | undefined = 6
expect(result).toBe(expected)
})
it('Test 06', () => {
const result: number | undefined = fn('o***')
const expected: number | undefined = 8
expect(result).toBe(expected)
})
it('Test 07', () => {
const result: number | undefined = fn('*o@')
const expected: number | undefined = 94
expect(result).toBe(expected)
})
it('Test 08', () => {
const result: number | undefined = fn('*#')
const expected: number | undefined = 49
expect(result).toBe(expected)
})
it('Test 09', () => {
const result: number | undefined = fn('@@@')
const expected: number | undefined = 300
expect(result).toBe(expected)
})
it('Test 10', () => {
const result: number | undefined = fn('#@')
const expected: number | undefined = 50
expect(result).toBe(expected)
})
it('Test 11', () => {
const result: number | undefined = fn('#@Z')
const expected: number | undefined = undefined
expect(result).toBe(expected)
})
})