Skip to content

Commit 7bb65b6

Browse files
committed
chore(test): config is added to avoid false positives
1 parent 15b02cd commit 7bb65b6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lib/hooks/useValidateChildren.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('useValidateChildren', () => {
3131
act(() => renderHook(() => useValidateChildren({ items, children: null })));
3232

3333
await waitFor(() => {
34-
expect(warnSpy).toHaveBeenCalledTimes(0);
34+
expect(warnSpy).not.toHaveBeenCalled();
3535
});
3636
});
3737

@@ -52,7 +52,7 @@ describe('useValidateChildren', () => {
5252
act(() => renderHook(() => useValidateChildren({ children, items: undefined })));
5353

5454
await waitFor(() => {
55-
expect(warnSpy).toHaveBeenCalledTimes(0);
55+
expect(warnSpy).not.toHaveBeenCalled();
5656
});
5757
});
5858

@@ -128,7 +128,7 @@ describe('useValidateChildren', () => {
128128
act(() => renderHook(() => useValidateChildren({ children, items: undefined })));
129129

130130
await waitFor(() => {
131-
expect(warnSpy).toHaveBeenCalledTimes(0);
131+
expect(warnSpy).not.toHaveBeenCalled();
132132
});
133133
});
134134
});

lib/setupTests.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { afterEach, vi } from 'vitest';
55

66
import * as hooks from '@/hooks';
77

8+
beforeEach(() => {
9+
expect.hasAssertions();
10+
});
11+
812
afterEach(() => {
913
cleanup();
1014
});

lib/utils/scrollToSectionView.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ describe('scrollToSectionView', () => {
4141

4242
it("should' not scroll if container is null", () => {
4343
scrollToSectionView(null, target);
44-
expect(container.scrollTo).toHaveBeenCalledTimes(0);
44+
expect(container.scrollTo).not.toHaveBeenCalled();
4545
});
4646

4747
it("should' not scroll if target is null", () => {
4848
scrollToSectionView(container, null);
49-
expect(container.scrollTo).toHaveBeenCalledTimes(0);
49+
expect(container.scrollTo).not.toHaveBeenCalled();
5050
});
5151

5252
it('should calculate scrollTop correctly and call scrollTo', () => {

0 commit comments

Comments
 (0)