FN-7101: stabilize App deep-link history state
Reset App deep-link test history state around replaceState stubs so full-file order no longer leaks navigation state. - Reset the real browser history snapshot before stubbing replaceState. - Restore replaceState before cleanup so history state and URL are reset through the original implementation. - Document why deep-link tests must clear navIndex between mounts. Files changed: packages/dashboard/app/components/__tests__/App.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) Fusion-Task-Id: FN-7101 Fusion-Task-Lineage: 5c44441f-f0d2-4ad3-bdcf-5a0a0e3e6e6f Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
This commit is contained in:
@@ -1411,6 +1411,11 @@ describe("App deep link handling", () => {
|
||||
const originalReplaceState = window.history.replaceState;
|
||||
|
||||
beforeEach(() => {
|
||||
/*
|
||||
* FNXC:DashboardTests 2026-06-26-23:40:
|
||||
* Deep-link App tests stub `history.replaceState` for assertions, but `useNavigationHistory` still writes real `pushState` entries and preserves existing `history.state.navIndex`. Reset the real history snapshot before installing the stub so full-file ordering cannot mount a later Back test with stale browser state.
|
||||
*/
|
||||
originalReplaceState.call(window.history, null, "", "/");
|
||||
window.history.replaceState = vi.fn();
|
||||
Object.defineProperty(window, "location", {
|
||||
configurable: true,
|
||||
@@ -1419,11 +1424,12 @@ describe("App deep link handling", () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
window.history.replaceState = originalReplaceState;
|
||||
originalReplaceState.call(window.history, null, "", "/");
|
||||
Object.defineProperty(window, "location", {
|
||||
configurable: true,
|
||||
value: originalLocation,
|
||||
});
|
||||
window.history.replaceState = originalReplaceState;
|
||||
});
|
||||
|
||||
it("fetches and opens the task modal when task query param is present", async () => {
|
||||
|
||||
Reference in New Issue
Block a user