-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path23.spec.ts
151 lines (144 loc) · 3.71 KB
/
23.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import { test, expectTypeOf, expect, describe } from 'vitest'
import { organizeChristmasDinner } from '../challenges/23'
describe('Challenge #23', () => {
test('Test #01', () => {
expectTypeOf(organizeChristmasDinner).returns.toEqualTypeOf([])
})
test('Test #02', () => {
const received = organizeChristmasDinner([
['christmas turkey', 'turkey', 'sauce', 'herbs'],
['cake', 'flour', 'sugar', 'egg'],
['hot chocolate', 'chocolate', 'milk', 'sugar'],
['pizza', 'sauce', 'tomato', 'cheese', 'ham']
])
const expected = [
[
'sauce',
'christmas turkey',
'pizza'
],
[
'sugar',
'cake',
'hot chocolate'
]
]
expect(received).toEqual(expected)
})
test('Test #03', () => {
const received = organizeChristmasDinner([
['fruit salad', 'apple', 'banana', 'orange'],
['berry smoothie', 'blueberry', 'banana', 'milk'],
['apple pie', 'apple', 'sugar', 'flour']
])
const expected = [
[
'apple',
'apple pie',
'fruit salad'
],
[
'banana',
'berry smoothie',
'fruit salad'
]
]
expect(received).toEqual(expected)
})
test('Test #04', () => {
const received = organizeChristmasDinner([
['gingerbread', 'flour', 'ginger', 'sugar'],
['glazed ham', 'ham', 'honey', 'sugar', 'vinegar'],
['roast chicken', 'chicken', 'rosemary', 'thyme', 'garlic'],
['vegetable soup', 'carrot', 'potato', 'onion', 'garlic'],
['fruit punch', 'apple juice', 'orange juice', 'sugar']
])
const expected = [
[
'garlic',
'roast chicken',
'vegetable soup'
],
[
'sugar',
'fruit punch',
'gingerbread',
'glazed ham'
]
]
expect(received).toEqual(expected)
})
test('Test #05', () => {
const received = organizeChristmasDinner([
['pumpkin pie', 'pumpkin', 'cinnamon', 'sugar', 'flour'],
['mashed potatoes', 'potatoes', 'butter', 'milk'],
['cinnamon rolls', 'flour', 'cinnamon', 'butter', 'sugar'],
['turkey stuffing', 'bread crumbs', 'celery', 'onion', 'butter']
])
const expected = [
[
'butter',
'cinnamon rolls',
'mashed potatoes',
'turkey stuffing'
],
[
'cinnamon',
'cinnamon rolls',
'pumpkin pie'
],
[
'flour',
'cinnamon rolls',
'pumpkin pie'
],
[
'sugar',
'cinnamon rolls',
'pumpkin pie'
]
]
expect(received).toEqual(expected)
})
test('Test #06', () => {
const received = organizeChristmasDinner([
['chicken alfredo', 'chicken', 'pasta', 'parmesan'],
['parmesan chicken', 'chicken', 'parmesan', 'bread crumbs'],
['pasta salad', 'pasta', 'olive oil', 'tomato'],
['tomato soup', 'tomato', 'basil', 'cream']
])
const expected = [
[
'chicken',
'chicken alfredo',
'parmesan chicken'
],
[
'parmesan',
'chicken alfredo',
'parmesan chicken'
],
[
'pasta',
'chicken alfredo',
'pasta salad'
],
[
'tomato',
'pasta salad',
'tomato soup'
]
]
expect(received).toEqual(expected)
})
test('Test #07', () => {
const received = organizeChristmasDinner([
['snowflake cookies', 'flour', 'sugar', 'vanilla'],
['winter stew', 'beef', 'carrots', 'potatoes'],
['holiday punch', 'cranberry juice', 'orange juice', 'sparkling water'],
['festive salad', 'lettuce', 'cranberries', 'walnuts']
])
const expected: string[][] = []
expect(received).toEqual(expected)
})
})