Skip to content

Commit 94ea59a

Browse files
committed
rename test utility rerender to mountComponent
1 parent 6bc9369 commit 94ea59a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

client/common/RouterTab.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ const mockPath = '/projects';
66
const mockLinkText = 'Projects';
77

88
describe('Tab', () => {
9-
function rerender() {
9+
function mountComponent() {
1010
return render(<Tab to={mockPath}>{mockLinkText}</Tab>);
1111
}
1212

1313
it('renders a react-router NavLink with correct text and path', async () => {
14-
rerender();
14+
mountComponent();
1515

1616
const linkElement = screen.getByText(mockLinkText);
1717
expect(linkElement).toBeInTheDocument();
@@ -22,7 +22,7 @@ describe('Tab', () => {
2222
});
2323

2424
it('includes the dashboard-header class names', () => {
25-
const { container } = rerender();
25+
const { container } = mountComponent();
2626

2727
const listItem = container.querySelector('li');
2828
const link = container.querySelector('a');

client/common/useModalClose.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,35 @@ describe('useModalClose', () => {
3030
);
3131
}
3232

33-
function rerender() {
33+
function mountComponent() {
3434
return render(<TestModal handleClose={onClose} />);
3535
}
3636

3737
it('calls onClose when clicking outside the modal', () => {
38-
const { getByTestId } = rerender();
38+
const { getByTestId } = mountComponent();
3939

4040
fireEvent.click(getByTestId('outside'));
4141

4242
expect(onClose).toHaveBeenCalled();
4343
});
4444

4545
it('does not call onClose when clicking inside the modal', () => {
46-
const { getByTestId } = rerender();
46+
const { getByTestId } = mountComponent();
4747

4848
fireEvent.click(getByTestId('modal'));
4949

5050
expect(onClose).not.toHaveBeenCalled();
5151
});
5252

5353
it('returns a ref that is focused on mount', () => {
54-
const { getByTestId } = rerender();
54+
const { getByTestId } = mountComponent();
5555
const modal = getByTestId('modal');
5656

5757
expect(document.activeElement).toBe(modal);
5858
});
5959

6060
it('calls useKeyDownHandlers with escape handler', () => {
61-
rerender();
61+
mountComponent();
6262

6363
expect(useKeyDownHandlers).toHaveBeenCalledWith({ escape: onClose });
6464
});

0 commit comments

Comments
 (0)