Skip to content

Commit 85dadbe

Browse files
committed
Added tests for constructCategoriesMap module
1 parent 83ed1f6 commit 85dadbe

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { constructCategoriesMap } from '../../src/utils/constructCategoriesMap';
2+
3+
it(`Should work`, () => {
4+
const option_1 = {
5+
color: 'blue',
6+
value: 'A'
7+
} as any,
8+
option_2 = {
9+
color: 'yellow',
10+
value: 'C'
11+
} as any,
12+
option_3 = {
13+
color: 'red',
14+
value: 'B'
15+
} as any;
16+
const categories_map = constructCategoriesMap({
17+
name: 'Options',
18+
options: [option_1, option_2, option_3],
19+
type: 'multi_select'
20+
});
21+
22+
expect(Array.from(categories_map.entries())).toStrictEqual([
23+
[
24+
'A',
25+
{
26+
items: [],
27+
...option_1
28+
}
29+
],
30+
[
31+
'B',
32+
{
33+
items: [],
34+
...option_3
35+
}
36+
],
37+
[
38+
'C',
39+
{
40+
items: [],
41+
...option_2
42+
}
43+
]
44+
]);
45+
});

0 commit comments

Comments
 (0)