Skip to content

Commit da8682a

Browse files
committed
test(VDisk): don't paint donors blue
1 parent 6b148b9 commit da8682a

File tree

1 file changed

+52
-4
lines changed

1 file changed

+52
-4
lines changed

src/containers/Storage/Vdisk/__tests__/colors.tsx

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,66 @@ describe('VDisk state', () => {
9898
VDiskState="OK" // severity 1, green
9999
Replicated={true}
100100
/>
101+
</>
102+
);
103+
104+
const [disk1, disk2] = getAllByRole('meter');
105+
106+
expect(disk1.className).toMatch(/_blue\b/i);
107+
expect(disk2.className).not.toMatch(/_blue\b/i);
108+
});
109+
110+
it('Should display replicating VDisks in a not-OK state with a regular color', () => {
111+
const {getAllByRole} = render(
112+
<>
101113
<VDisk
102-
VDiskId={{Domain: 3}}
114+
VDiskId={{Domain: 1}}
103115
VDiskState="Initial" // severity 3, yellow
104116
Replicated={false}
117+
/>
118+
<VDisk
119+
VDiskId={{Domain: 2}}
120+
VDiskState="PDiskError" // severity 5, red
121+
Replicated={false}
122+
/>
123+
</>
124+
);
125+
126+
const [disk1, disk2] = getAllByRole('meter');
127+
128+
expect(disk1.className).toMatch(/_yellow\b/i);
129+
expect(disk2.className).toMatch(/_red\b/i);
130+
});
131+
132+
it('Should always display donor VDisks with a regular color', () => {
133+
const {getAllByRole} = render(
134+
<>
135+
<VDisk
136+
VDiskId={{Domain: 1}}
137+
VDiskState="OK" // severity 1, green
138+
Replicated={false} // donors are always in the not replicated state since they are leftovers
139+
DonorMode
140+
/>
141+
<VDisk
142+
VDiskId={{Domain: 2}}
143+
VDiskState="Initial" // severity 3, yellow
144+
Replicated={false}
145+
DonorMode
146+
/>
147+
<VDisk
148+
VDiskId={{Domain: 3}}
149+
VDiskState="PDiskError" // severity 5, red
150+
Replicated={false}
151+
DonorMode
105152
/>
106153
</>
107154
);
108155

109156
const [disk1, disk2, disk3] = getAllByRole('meter');
110157

111-
expect(disk1.className).toMatch(/_blue\b/i);
112-
expect(disk2.className).not.toMatch(/_blue\b/i);
113-
expect(disk3.className).not.toMatch(/_blue\b/i);
158+
expect(disk1.className).not.toMatch(/_blue\b/i);
159+
expect(disk1.className).toMatch(/_green\b/i);
160+
expect(disk2.className).toMatch(/_yellow\b/i);
161+
expect(disk3.className).toMatch(/_red\b/i);
114162
});
115163
});

0 commit comments

Comments
 (0)