Skip to content

Commit 52996cd

Browse files
committed
[@mantine/charts] Stabilize is-recharts-v3 test
1 parent 232afd3 commit 52996cd

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed
Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
11
describe('@mantine/charts/utils/is-recharts-v3', () => {
22
afterEach(() => {
3-
jest.clearAllMocks();
3+
jest.resetModules();
4+
jest.resetAllMocks();
5+
jest.dontMock('recharts');
46
});
57

68
it('returns false when useActiveTooltipLabel is not present (Recharts v2)', async () => {
9+
let result: boolean | undefined;
10+
711
await jest.isolateModulesAsync(async () => {
8-
jest.resetModules();
912
jest.doMock('recharts', () => ({}), { virtual: true });
1013
const { isRechartsV3 } = await import('./is-recharts-v3');
11-
expect(isRechartsV3()).toBe(false);
14+
result = isRechartsV3();
1215
});
16+
17+
expect(result).toBe(false);
1318
});
1419

1520
it('returns true when useActiveTooltipLabel is present (Recharts v3)', async () => {
21+
let result: boolean | undefined;
22+
1623
await jest.isolateModulesAsync(async () => {
17-
jest.resetModules();
18-
jest.doMock('recharts', () => ({ useActiveTooltipLabel: () => 'mocked' }), { virtual: true });
24+
jest.doMock(
25+
'recharts',
26+
() => ({
27+
useActiveTooltipLabel: () => 'mocked',
28+
}),
29+
{ virtual: true }
30+
);
1931
const { isRechartsV3 } = await import('./is-recharts-v3');
20-
expect(isRechartsV3()).toBe(true);
32+
result = isRechartsV3();
2133
});
34+
35+
expect(result).toBe(true);
2236
});
2337
});

0 commit comments

Comments
 (0)