|
1 | 1 | import { checkIfAllBlocksInGroupAreHidden } from "./GroupUtils"; |
2 | 2 |
|
3 | | -import { IfcBlock, IfcGroup } from "@/app/types"; |
| 3 | +import { tBlockMapping } from "@/app/types"; |
4 | 4 |
|
5 | 5 | test("group with all hidden blocks returns true", () => { |
6 | | - const aHiddenBlock: IfcBlock = { pvaddress: "", visible: false }; |
7 | | - let group: IfcGroup = { name: "testing", blocks: [aHiddenBlock] }; |
8 | | - const result = checkIfAllBlocksInGroupAreHidden(group); |
| 6 | + let blocks: tBlockMapping = new Map(); |
| 7 | + blocks.set("testing", { pvaddress: "", visible: false }); |
| 8 | + const result = checkIfAllBlocksInGroupAreHidden(blocks); |
9 | 9 | expect(result).toBe(true); |
10 | 10 | }); |
11 | 11 |
|
12 | | -test("group with all visible blocks returns true", () => { |
13 | | - let group: IfcGroup = { |
14 | | - name: "testing", |
15 | | - blocks: [{ pvaddress: "", visible: true }], |
16 | | - }; |
17 | | - const result = checkIfAllBlocksInGroupAreHidden(group); |
| 12 | +test("group with all visible blocks returns false", () => { |
| 13 | + let blocks: tBlockMapping = new Map(); |
| 14 | + blocks.set("testing", { pvaddress: "testing", visible: true }); |
| 15 | + const result = checkIfAllBlocksInGroupAreHidden(blocks); |
18 | 16 | expect(result).toBe(false); |
19 | 17 | }); |
20 | 18 |
|
21 | | -test("group with mixed visible blocks returns true", () => { |
22 | | - let group: IfcGroup = { |
23 | | - name: "testing", |
24 | | - blocks: [ |
25 | | - { pvaddress: "", visible: false }, |
26 | | - { pvaddress: "", visible: true }, |
27 | | - ], |
28 | | - }; |
29 | | - const result = checkIfAllBlocksInGroupAreHidden(group); |
| 19 | +test("group with mixed visible blocks returns false", () => { |
| 20 | + let blocks: tBlockMapping = new Map(); |
| 21 | + blocks.set("block1", { pvaddress: "block1", visible: false }); |
| 22 | + blocks.set("block2", { pvaddress: "block2", visible: true }); |
| 23 | + const result = checkIfAllBlocksInGroupAreHidden(blocks); |
30 | 24 | expect(result).toBe(false); |
31 | 25 | }); |
0 commit comments