Skip to content

Commit 3efbc1c

Browse files
committed
chore: simplify warning checks in useValidateChildren tests
1 parent 7bb65b6 commit 3efbc1c

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/hooks/useValidateChildren.test.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ describe('useValidateChildren', () => {
3030

3131
act(() => renderHook(() => useValidateChildren({ items, children: null })));
3232

33-
await waitFor(() => {
34-
expect(warnSpy).not.toHaveBeenCalled();
35-
});
33+
expect(warnSpy).not.toHaveBeenCalled();
3634
});
3735

3836
it('should not log warnings when NavItems and ContentSections match', async () => {
@@ -51,9 +49,7 @@ describe('useValidateChildren', () => {
5149

5250
act(() => renderHook(() => useValidateChildren({ children, items: undefined })));
5351

54-
await waitFor(() => {
55-
expect(warnSpy).not.toHaveBeenCalled();
56-
});
52+
expect(warnSpy).not.toHaveBeenCalled();
5753
});
5854

5955
it('should log warnings for missing ContentSections', async () => {
@@ -127,8 +123,6 @@ describe('useValidateChildren', () => {
127123

128124
act(() => renderHook(() => useValidateChildren({ children, items: undefined })));
129125

130-
await waitFor(() => {
131-
expect(warnSpy).not.toHaveBeenCalled();
132-
});
126+
expect(warnSpy).not.toHaveBeenCalled();
133127
});
134128
});

lib/setupTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Object.defineProperty(HTMLElement.prototype, 'scrollTo', {
2525

2626
// This mock is necessary because JSDOM does not implement IntersectionObserver
2727
export class IntersectionObserverMock implements IntersectionObserver {
28-
static readonly instances: IntersectionObserverMock[] = [];
28+
public static instances: IntersectionObserverMock[] = [];
2929
callback: IntersectionObserverCallback;
3030
elements: Element[] = [];
3131
root: Element | Document | null = null;

0 commit comments

Comments
 (0)