Skip to content

Commit

Permalink
Workaround react-router change preventing rerender from working in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanGreene committed Feb 2, 2025
1 parent cdf08d1 commit e342376
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/containers/SideNav/SideNav.test.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2024 The Tekton Authors
Copyright 2019-2025 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -35,10 +35,12 @@ const mockExtensions = [
];

it('SideNav renders only when expanded', () => {
const { queryByText, rerender } = renderWithRouter(<SideNav expanded />);
const { queryByText } = renderWithRouter(<SideNav expanded />);
expect(queryByText(/Tekton resources/)).toBeTruthy();
});

renderWithRouter(<SideNav />, { rerender });
it('SideNav renders nothing when collapsed', () => {
const { queryByText } = renderWithRouter(<SideNav />);
expect(queryByText(/Tekton resources/)).toBeFalsy();
});

Expand Down

0 comments on commit e342376

Please sign in to comment.