diff --git a/web/src/primaryAction.test.tsx b/web/src/primaryAction.test.tsx index b6de3aa0a..a40be4a41 100644 --- a/web/src/primaryAction.test.tsx +++ b/web/src/primaryAction.test.tsx @@ -72,7 +72,7 @@ describe('primary actions', () => { expect(latestHandler).toHaveBeenCalledOnce(); }); - it('cleans up the old route and clears the registration on unmount', () => { + it("moves the same owner's registration to a new route and clears it on unmount", () => { const handler = vi.fn(); const view = render( @@ -105,7 +105,7 @@ describe('primary actions', () => { expect(screen.getByRole('button', { name: 'Run channels' })).toBeDisabled(); }); - it('does not let an older owner clear a newer registration', () => { + it('does not let an older owner rerender or cleanup reclaim a newer registration', () => { const olderHandler = vi.fn(); const updatedOlderHandler = vi.fn(); const newerHandler = vi.fn(); @@ -130,6 +130,9 @@ describe('primary actions', () => { ); + fireEvent.click(screen.getByRole('button', { name: 'Run schedules' })); + expect(newerHandler).toHaveBeenCalledOnce(); + view.rerender( @@ -140,7 +143,7 @@ describe('primary actions', () => { expect(olderHandler).not.toHaveBeenCalled(); expect(updatedOlderHandler).not.toHaveBeenCalled(); - expect(newerHandler).toHaveBeenCalledOnce(); + expect(newerHandler).toHaveBeenCalledTimes(2); }); it('lets screens render harmlessly without a provider', () => {