Skip to content

Commit 9fbae28

Browse files
committed
fix(isMobile): performance
1 parent 2c78566 commit 9fbae28

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/hooks.test.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,12 @@ describe('hooks', () => {
513513
return <div>{isMobile ? 'mobile' : 'pc'}</div>;
514514
};
515515

516-
const { container } = render(<Demo />);
517-
expect(container.textContent).toBe('pc');
518-
519516
const navigatorSpy = jest
520517
.spyOn(navigator, 'userAgent', 'get')
521518
.mockImplementation(() => 'Android');
522-
const { container: container2 } = render(<Demo />);
523-
expect(container2.textContent).toBe('mobile');
519+
520+
const { container } = render(<Demo />);
521+
expect(container.textContent).toBe('mobile');
524522

525523
navigatorSpy.mockRestore();
526524
});

0 commit comments

Comments
 (0)