Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adhityamamallan committed Sep 3, 2024
1 parent 86a2f45 commit ca47d77
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,31 @@ describe('DomainPageTabs', () => {
expect(mockPushFn).toHaveBeenCalledWith('page-2');
});

it('retains query params when new tab is clicked', () => {
// TODO: this is a bit hacky, see if there is a better way to mock the window search property
const originalWindow = window;
window = Object.create(window);
Object.defineProperty(window, 'location', {
value: {
search: '?queryParam1=one&queryParam2=two',
},
writable: true,
});

render(<DomainPageTabs />);

const page2Tab = screen.getByText('Page 2');
act(() => {
fireEvent.click(page2Tab);
});

expect(mockPushFn).toHaveBeenCalledWith(
'page-2?queryParam1=one&queryParam2=two'
);

window = originalWindow;
});

it('renders tabs artworks correctly', () => {
render(<DomainPageTabs />);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe(getDomainWorkflowsErrorConfig.name, () => {
getDomainWorkflowsErrorConfig(new Error(NO_WORKFLOWS_ERROR_MESSAGE))
).toEqual({
message: 'No workflows found for this domain',
omitLogging: true,
actions: [
{
kind: 'link-external',
Expand Down

0 comments on commit ca47d77

Please sign in to comment.