From d57ccf552bad7b39628144b7289f18624666893d Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Wed, 22 Jan 2025 09:39:16 -0500 Subject: [PATCH 01/12] wip fix timeout on faq page --- .../src/components/TimeoutModal/index.tsx | 10 +- react-app/src/main.tsx | 12 +- react-app/src/router.test.tsx | 7 + react-app/src/router.tsx | 225 ++++++++++-------- 4 files changed, 139 insertions(+), 115 deletions(-) create mode 100644 react-app/src/router.test.tsx diff --git a/react-app/src/components/TimeoutModal/index.tsx b/react-app/src/components/TimeoutModal/index.tsx index 6be317f055..9901177529 100644 --- a/react-app/src/components/TimeoutModal/index.tsx +++ b/react-app/src/components/TimeoutModal/index.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useGetUser } from "@/api"; import { Button, Dialog, @@ -7,14 +7,14 @@ import { DialogHeader, DialogTitle, } from "@/components"; +import { useCountdown, useIdle } from "@/hooks"; +import { DialogDescription } from "@radix-ui/react-dialog"; import { Auth } from "aws-amplify"; -import { useIdle, useCountdown } from "@/hooks"; -import { useGetUser } from "@/api"; import { intervalToDuration } from "date-fns"; import pluralize from "pluralize"; -import { DialogDescription } from "@radix-ui/react-dialog"; +import { useEffect, useState } from "react"; -const TWENTY_MINS_IN_MILS = 1000 * 60 * 20; +const TWENTY_MINS_IN_MILS = 1000 * 60 * 1; const TEN_MINS_IN_MILS = 60 * 10; export const TimeoutModal = () => { diff --git a/react-app/src/main.tsx b/react-app/src/main.tsx index 1765de9361..a414b92999 100644 --- a/react-app/src/main.tsx +++ b/react-app/src/main.tsx @@ -1,14 +1,13 @@ +import config from "@/config"; +import "@fontsource/open-sans"; +import { QueryClientProvider } from "@tanstack/react-query"; +import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; +import { asyncWithLDProvider } from "launchdarkly-react-client-sdk"; import React from "react"; import ReactDOM from "react-dom/client"; import { RouterProvider } from "react-router"; -import "@fontsource/open-sans"; import "./index.css"; import { queryClient, router } from "./router"; -import { QueryClientProvider } from "@tanstack/react-query"; -import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; -import { TimeoutModal } from "@/components"; -import config from "@/config"; -import { asyncWithLDProvider } from "launchdarkly-react-client-sdk"; const ldClientId = config.launchDarkly?.CLIENT_ID; if (ldClientId === undefined) { @@ -30,7 +29,6 @@ const initializeLaunchDarkly = async () => { - diff --git a/react-app/src/router.test.tsx b/react-app/src/router.test.tsx new file mode 100644 index 0000000000..af9147035d --- /dev/null +++ b/react-app/src/router.test.tsx @@ -0,0 +1,7 @@ +import { describe, it } from "vitest"; + +describe("Route timeout modal tests", () => { + it("Private route includes ", () => {}); + + it("Public route does not include ", () => {}); +}); diff --git a/react-app/src/router.tsx b/react-app/src/router.tsx index 0dc701b45d..882eff6766 100644 --- a/react-app/src/router.tsx +++ b/react-app/src/router.tsx @@ -1,119 +1,138 @@ -import { createBrowserRouter } from "react-router"; -import * as F from "@/features"; import * as C from "@/components"; +import { TimeoutModal } from "@/components"; +import * as F from "@/features"; import { postSubmissionLoader, PostSubmissionWrapper, } from "@/features/forms/post-submission/post-submission-forms"; import { QueryClient } from "@tanstack/react-query"; +import { createBrowserRouter } from "react-router"; export const queryClient = new QueryClient(); - export const FAQ_TAB = "faq-tab"; +// These routes are divided into public and private, but this distinction +// is not used for enforcing authentication. Instead, private routes include +// a Timeout component that logs out a user after a period of inactivity. + +const PrivateWrapper = ({ element: Component }) => { + return ( + <> + + {Component} + + ); +}; + +const publicRoutes = [ + { path: "/", index: true, element: }, + { path: "/faq", element: }, + { path: "/faq/:id", element: }, + { path: "/webforms", element: }, + { path: "/webform/:id/:version", element: }, +]; + +const privateRoutes = [ + { + path: "/dashboard", + element: } />, + loader: F.dashboardLoader(queryClient), + }, + { + path: "/details/:authority/:id", + element: , + loader: F.packageDetailsLoader, + }, + { + path: "/new-submission/spa/medicaid/create", + element: } />, + }, + { + path: "/new-submission/spa/chip/create", + element: } />, + }, + { + path: "/new-submission/waiver/b/capitated/amendment/create", + element: } />, + }, + { + path: "/new-submission/waiver/b/capitated/initial/create", + element: } />, + }, + { + path: "/new-submission/waiver/b/capitated/renewal/create", + element: } />, + }, + { + path: "/new-submission/waiver/b/b4/renewal/create", + element: } />, + }, + { + path: "/new-submission/waiver/b/b4/initial/create", + element: } />, + }, + { + path: "/new-submission/waiver/b/b4/amendment/create", + element: } />, + }, + { + path: "/new-submission/waiver/app-k", + element: } />, + }, + { + path: "/new-submission/waiver/temporary-extensions", + element: } />, + }, + { + path: "/new-submission", + element: } />, + }, + { + path: "/new-submission/spa", + element: } />, + }, + { + path: "/new-submission/waiver", + element: } />, + }, + { + path: "/new-submission/waiver/b", + element: } />, + }, + { + path: "/new-submission/waiver/b/b4", + element: } />, + }, + { + path: "/new-submission/waiver/b/capitated", + element: } />, + }, + { + path: "/new-submission/spa/medicaid", + element: } />, + }, + { + path: "/new-submission/spa/chip", + element: } />, + }, + { + path: "/new-submission/spa/medicaid/landing/medicaid-eligibility", + element: } />, + }, + + { path: "/profile", element: } /> }, + { path: "/guides/abp", element: } /> }, + { + path: "/actions/:type/:authority/:id", + element: } />, + loader: postSubmissionLoader, + }, +]; + export const router = createBrowserRouter([ { path: "/", element: , - children: [ - { path: "/", index: true, element: }, - { path: "/faq", element: }, - { path: "/faq/:id", element: }, - { - path: "/dashboard", - element: , - loader: F.dashboardLoader(queryClient), - }, - { - path: "/details/:authority/:id", - element: , - loader: F.packageDetailsLoader, - }, - { - path: "/new-submission/spa/medicaid/create", - element: , - }, - { - path: "/new-submission/spa/chip/create", - element: , - }, - { - path: "/new-submission/waiver/b/capitated/amendment/create", - element: , - }, - { - path: "/new-submission/waiver/b/capitated/initial/create", - element: , - }, - { - path: "/new-submission/waiver/b/capitated/renewal/create", - element: , - }, - { - path: "/new-submission/waiver/b/b4/renewal/create", - element: , - }, - { - path: "/new-submission/waiver/b/b4/initial/create", - element: , - }, - { - path: "/new-submission/waiver/b/b4/amendment/create", - element: , - }, - { - path: "/new-submission/waiver/app-k", - element: , - }, - { - path: "/new-submission/waiver/temporary-extensions", - element: , - }, - { - path: "/new-submission", - element: , - }, - { - path: "/new-submission/spa", - element: , - }, - { - path: "/new-submission/waiver", - element: , - }, - { - path: "/new-submission/waiver/b", - element: , - }, - { - path: "/new-submission/waiver/b/b4", - element: , - }, - { - path: "/new-submission/waiver/b/capitated", - element: , - }, - { - path: "/new-submission/spa/medicaid", - element: , - }, - { - path: "/new-submission/spa/chip", - element: , - }, - { - path: "/new-submission/spa/medicaid/landing/medicaid-eligibility", - element: , - }, - { path: "/webforms", element: }, - { path: "/webform/:id/:version", element: }, - { path: "/profile", element: }, - { path: "/guides/abp", element: }, - { - path: "/actions/:type/:authority/:id", - element: , - loader: postSubmissionLoader, - }, - ], + children: [...privateRoutes, ...publicRoutes], loader: F.loader(queryClient), HydrateFallback: () => null, }, From cd243ea3566604d43f9b0fe341b9c3d6ad8d000d Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Wed, 22 Jan 2025 10:06:48 -0500 Subject: [PATCH 02/12] add test for updated router logic --- react-app/src/router.test.tsx | 51 ++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/react-app/src/router.test.tsx b/react-app/src/router.test.tsx index af9147035d..a3b989af58 100644 --- a/react-app/src/router.test.tsx +++ b/react-app/src/router.test.tsx @@ -1,7 +1,50 @@ -import { describe, it } from "vitest"; +import { render } from "@testing-library/react"; +import { MemoryRouter, Route, Routes } from "react-router-dom"; +import { describe, expect, it, vi } from "vitest"; +import { router } from "./router"; -describe("Route timeout modal tests", () => { - it("Private route includes ", () => {}); +vi.mock("@/components", () => ({ + TimeoutModal: () =>
TimeoutModal
, + Layout: ({ children }) =>
{children}
, +})); - it("Public route does not include ", () => {}); +vi.mock(import("@/features"), async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + Welcome: () =>
Welcome
, + Dashboard: () =>
Dashboard
, + dashboardLoader: vi.fn(), + loader: vi.fn(), + }; +}); + +describe("Router tests", () => { + it("should include in private routes", () => { + const { getByTestId } = render( + + + {router.routes[0].children.map((route) => ( + + ))} + + , + ); + + expect(getByTestId("timeout-modal")).toBeDefined(); + }); + + it("should not include in public routes", () => { + const { queryByTestId } = render( + + + {router.routes[0].children.map((route) => ( + + ))} + + , + ); + + expect(queryByTestId("timeout-modal")).toBeNull(); + }); }); From c667f25551c6dbc4a1b83361069821f952a37863 Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Wed, 22 Jan 2025 14:21:04 -0500 Subject: [PATCH 03/12] reset timer to origina: l --- react-app/src/components/TimeoutModal/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-app/src/components/TimeoutModal/index.tsx b/react-app/src/components/TimeoutModal/index.tsx index 9901177529..bf9a9e9bbc 100644 --- a/react-app/src/components/TimeoutModal/index.tsx +++ b/react-app/src/components/TimeoutModal/index.tsx @@ -14,7 +14,7 @@ import { intervalToDuration } from "date-fns"; import pluralize from "pluralize"; import { useEffect, useState } from "react"; -const TWENTY_MINS_IN_MILS = 1000 * 60 * 1; +const TWENTY_MINS_IN_MILS = 1000 * 60 * 20; const TEN_MINS_IN_MILS = 60 * 10; export const TimeoutModal = () => { From ac0d6dbd15c3c30a37ea5b89e63540744a4bf7a5 Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Wed, 22 Jan 2025 15:44:54 -0500 Subject: [PATCH 04/12] fix import mistake --- react-app/src/router.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-app/src/router.test.tsx b/react-app/src/router.test.tsx index a3b989af58..c1bd581f18 100644 --- a/react-app/src/router.test.tsx +++ b/react-app/src/router.test.tsx @@ -1,5 +1,5 @@ import { render } from "@testing-library/react"; -import { MemoryRouter, Route, Routes } from "react-router-dom"; +import { MemoryRouter, Route, Routes } from "react-router"; import { describe, expect, it, vi } from "vitest"; import { router } from "./router"; From 5f51f1b1b7ac39e22d033d48339ac0325f5468ad Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Wed, 22 Jan 2025 16:02:44 -0500 Subject: [PATCH 05/12] remove unnecessary component prop --- react-app/src/router.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react-app/src/router.test.tsx b/react-app/src/router.test.tsx index c1bd581f18..ca1bc8522e 100644 --- a/react-app/src/router.test.tsx +++ b/react-app/src/router.test.tsx @@ -25,7 +25,7 @@ describe("Router tests", () => { {router.routes[0].children.map((route) => ( - + ))} , @@ -39,7 +39,7 @@ describe("Router tests", () => { {router.routes[0].children.map((route) => ( - + ))} , From b72a0863bcf1768a58aed0673cd96aaf1896be28 Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Thu, 23 Jan 2025 10:32:15 -0500 Subject: [PATCH 06/12] refactor routes to use new pattern, wip test fixes --- .../src/components/TimeoutModal/index.tsx | 2 +- react-app/src/router.test.tsx | 28 ++- react-app/src/router.tsx | 232 +++++++++--------- 3 files changed, 129 insertions(+), 133 deletions(-) diff --git a/react-app/src/components/TimeoutModal/index.tsx b/react-app/src/components/TimeoutModal/index.tsx index bf9a9e9bbc..9901177529 100644 --- a/react-app/src/components/TimeoutModal/index.tsx +++ b/react-app/src/components/TimeoutModal/index.tsx @@ -14,7 +14,7 @@ import { intervalToDuration } from "date-fns"; import pluralize from "pluralize"; import { useEffect, useState } from "react"; -const TWENTY_MINS_IN_MILS = 1000 * 60 * 20; +const TWENTY_MINS_IN_MILS = 1000 * 60 * 1; const TEN_MINS_IN_MILS = 60 * 10; export const TimeoutModal = () => { diff --git a/react-app/src/router.test.tsx b/react-app/src/router.test.tsx index ca1bc8522e..0e0255ab90 100644 --- a/react-app/src/router.test.tsx +++ b/react-app/src/router.test.tsx @@ -3,8 +3,10 @@ import { MemoryRouter, Route, Routes } from "react-router"; import { describe, expect, it, vi } from "vitest"; import { router } from "./router"; +import type { RouteObject } from "react-router"; + vi.mock("@/components", () => ({ - TimeoutModal: () =>
TimeoutModal
, + TimeoutModal: () =>
Mocked TimeoutModal
, Layout: ({ children }) =>
{children}
, })); @@ -20,31 +22,31 @@ vi.mock(import("@/features"), async (importOriginal) => { }); describe("Router tests", () => { - it("should include in private routes", () => { - const { getByTestId } = render( - + it("should not include by default", () => { + const { queryByTestId } = render( + - {router.routes[0].children.map((route) => ( - + {(router.routes[0].children as RouteObject[]).map((route) => ( + ))} , ); - expect(getByTestId("timeout-modal")).toBeDefined(); + expect(queryByTestId("timeout-modal")).toBeNull(); }); - it("should not include in public routes", () => { - const { queryByTestId } = render( - + it("should include in RoutesWithTimeout", () => { + const { getByTestId } = render( + - {router.routes[0].children.map((route) => ( - + {(router.routes[0].children as RouteObject[]).map((route) => ( + ))} , ); - expect(queryByTestId("timeout-modal")).toBeNull(); + expect(getByTestId("timeout-modal")).toBeDefined(); }); }); diff --git a/react-app/src/router.tsx b/react-app/src/router.tsx index 882eff6766..6f8b953aa9 100644 --- a/react-app/src/router.tsx +++ b/react-app/src/router.tsx @@ -6,133 +6,127 @@ import { PostSubmissionWrapper, } from "@/features/forms/post-submission/post-submission-forms"; import { QueryClient } from "@tanstack/react-query"; -import { createBrowserRouter } from "react-router"; +import { createBrowserRouter, Outlet } from "react-router"; export const queryClient = new QueryClient(); export const FAQ_TAB = "faq-tab"; -// These routes are divided into public and private, but this distinction -// is not used for enforcing authentication. Instead, private routes include -// a Timeout component that logs out a user after a period of inactivity. - -const PrivateWrapper = ({ element: Component }) => { - return ( - <> - - {Component} - - ); -}; - -const publicRoutes = [ - { path: "/", index: true, element: }, - { path: "/faq", element: }, - { path: "/faq/:id", element: }, - { path: "/webforms", element: }, - { path: "/webform/:id/:version", element: }, -]; - -const privateRoutes = [ - { - path: "/dashboard", - element: } />, - loader: F.dashboardLoader(queryClient), - }, - { - path: "/details/:authority/:id", - element: , - loader: F.packageDetailsLoader, - }, - { - path: "/new-submission/spa/medicaid/create", - element: } />, - }, - { - path: "/new-submission/spa/chip/create", - element: } />, - }, - { - path: "/new-submission/waiver/b/capitated/amendment/create", - element: } />, - }, - { - path: "/new-submission/waiver/b/capitated/initial/create", - element: } />, - }, - { - path: "/new-submission/waiver/b/capitated/renewal/create", - element: } />, - }, - { - path: "/new-submission/waiver/b/b4/renewal/create", - element: } />, - }, - { - path: "/new-submission/waiver/b/b4/initial/create", - element: } />, - }, - { - path: "/new-submission/waiver/b/b4/amendment/create", - element: } />, - }, - { - path: "/new-submission/waiver/app-k", - element: } />, - }, - { - path: "/new-submission/waiver/temporary-extensions", - element: } />, - }, - { - path: "/new-submission", - element: } />, - }, - { - path: "/new-submission/spa", - element: } />, - }, - { - path: "/new-submission/waiver", - element: } />, - }, - { - path: "/new-submission/waiver/b", - element: } />, - }, - { - path: "/new-submission/waiver/b/b4", - element: } />, - }, - { - path: "/new-submission/waiver/b/capitated", - element: } />, - }, - { - path: "/new-submission/spa/medicaid", - element: } />, - }, - { - path: "/new-submission/spa/chip", - element: } />, - }, - { - path: "/new-submission/spa/medicaid/landing/medicaid-eligibility", - element: } />, - }, - - { path: "/profile", element: } /> }, - { path: "/guides/abp", element: } /> }, - { - path: "/actions/:type/:authority/:id", - element: } />, - loader: postSubmissionLoader, - }, -]; +const RoutesWithTimeout = () => ( + <> + + + +); export const router = createBrowserRouter([ { path: "/", element: , - children: [...privateRoutes, ...publicRoutes], + children: [ + { path: "/", index: true, element: }, + { path: "/faq", element: }, + { path: "/faq/:id", element: }, + { path: "/webforms", element: }, + { path: "/webform/:id/:version", element: }, + { + element: , + children: [ + { + path: "/dashboard", + element: , + loader: F.dashboardLoader(queryClient), + }, + { + path: "/details/:authority/:id", + element: , + loader: F.packageDetailsLoader, + }, + { + path: "/new-submission/spa/medicaid/create", + element: , + }, + { + path: "/new-submission/spa/chip/create", + element: , + }, + { + path: "/new-submission/waiver/b/capitated/amendment/create", + element: , + }, + { + path: "/new-submission/waiver/b/capitated/initial/create", + element: , + }, + { + path: "/new-submission/waiver/b/capitated/renewal/create", + element: , + }, + { + path: "/new-submission/waiver/b/b4/renewal/create", + element: , + }, + { + path: "/new-submission/waiver/b/b4/initial/create", + element: , + }, + { + path: "/new-submission/waiver/b/b4/amendment/create", + element: , + }, + { + path: "/new-submission/waiver/app-k", + element: , + }, + { + path: "/new-submission/waiver/temporary-extensions", + element: , + }, + { + path: "/new-submission", + element: , + }, + { + path: "/new-submission/spa", + element: , + }, + { + path: "/new-submission/waiver", + element: , + }, + { + path: "/new-submission/waiver/b", + element: , + }, + { + path: "/new-submission/waiver/b/b4", + element: , + }, + { + path: "/new-submission/waiver/b/capitated", + element: , + }, + { + path: "/new-submission/spa/medicaid", + element: , + }, + { + path: "/new-submission/spa/chip", + element: , + }, + { + path: "/new-submission/spa/medicaid/landing/medicaid-eligibility", + element: , + }, + + { path: "/profile", element: }, + { path: "/guides/abp", element: }, + { + path: "/actions/:type/:authority/:id", + element: , + loader: postSubmissionLoader, + }, + ], + }, + ], loader: F.loader(queryClient), HydrateFallback: () => null, }, From 2786c571356552a4febb17dade861f4fc3b181c0 Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Thu, 23 Jan 2025 11:19:10 -0500 Subject: [PATCH 07/12] updates --- react-app/src/router.test.tsx | 66 ++++++++++++++++------------------- react-app/src/router.tsx | 1 - 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/react-app/src/router.test.tsx b/react-app/src/router.test.tsx index 0e0255ab90..3f683789f1 100644 --- a/react-app/src/router.test.tsx +++ b/react-app/src/router.test.tsx @@ -1,52 +1,48 @@ -import { render } from "@testing-library/react"; -import { MemoryRouter, Route, Routes } from "react-router"; +import { render, screen } from "@testing-library/react"; +import { RouterProvider } from "react-router"; +import { createMemoryRouter } from "react-router-dom"; import { describe, expect, it, vi } from "vitest"; import { router } from "./router"; -import type { RouteObject } from "react-router"; - -vi.mock("@/components", () => ({ - TimeoutModal: () =>
Mocked TimeoutModal
, - Layout: ({ children }) =>
{children}
, -})); +vi.mock(import("@/components"), async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + Layout: vi.fn(() =>
Mock Layout
), + TimeoutModal: vi.fn(() =>
Mock TimeoutModal
), + }; +}); vi.mock(import("@/features"), async (importOriginal) => { const actual = await importOriginal(); return { ...actual, - Welcome: () =>
Welcome
, - Dashboard: () =>
Dashboard
, + Welcome: () =>
Mock Welcome
, + Dashboard: () =>
Mock Dashboard
, dashboardLoader: vi.fn(), loader: vi.fn(), }; }); -describe("Router tests", () => { - it("should not include by default", () => { - const { queryByTestId } = render( - - - {(router.routes[0].children as RouteObject[]).map((route) => ( - - ))} - - , - ); - - expect(queryByTestId("timeout-modal")).toBeNull(); +// Test suite +describe("RoutesWithTimeout", () => { + it("should not render on `/faq` route", async () => { + const testRouter = createMemoryRouter(router.routes[0].children, { + initialEntries: ["/faq"], + }); + + render(); + + expect(screen.queryByText("Mock TimeoutModal")).not.toBeInTheDocument(); }); - it("should include in RoutesWithTimeout", () => { - const { getByTestId } = render( - - - {(router.routes[0].children as RouteObject[]).map((route) => ( - - ))} - - , - ); - - expect(getByTestId("timeout-modal")).toBeDefined(); + it("should render on `/dashboard` route", async () => { + const testRouter = createMemoryRouter(router.routes[0].children, { + initialEntries: ["/dashboard"], + }); + + render(); + + expect(screen.getByText("Mock TimeoutModal")).toBeInTheDocument(); }); }); diff --git a/react-app/src/router.tsx b/react-app/src/router.tsx index 6f8b953aa9..b2a89cf50b 100644 --- a/react-app/src/router.tsx +++ b/react-app/src/router.tsx @@ -116,7 +116,6 @@ export const router = createBrowserRouter([ path: "/new-submission/spa/medicaid/landing/medicaid-eligibility", element: , }, - { path: "/profile", element: }, { path: "/guides/abp", element: }, { From ae3db15658ab1e71d6afd0b4a6c541244631e534 Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Thu, 23 Jan 2025 11:25:06 -0500 Subject: [PATCH 08/12] remove comment --- react-app/src/router.test.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/react-app/src/router.test.tsx b/react-app/src/router.test.tsx index 3f683789f1..6b89cc8a68 100644 --- a/react-app/src/router.test.tsx +++ b/react-app/src/router.test.tsx @@ -24,7 +24,6 @@ vi.mock(import("@/features"), async (importOriginal) => { }; }); -// Test suite describe("RoutesWithTimeout", () => { it("should not render on `/faq` route", async () => { const testRouter = createMemoryRouter(router.routes[0].children, { From df38c549d61b32c158a97b04df6d21cbf4a3a53c Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Thu, 23 Jan 2025 11:35:41 -0500 Subject: [PATCH 09/12] fix import issue --- react-app/src/router.test.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/react-app/src/router.test.tsx b/react-app/src/router.test.tsx index 6b89cc8a68..32300ed3cc 100644 --- a/react-app/src/router.test.tsx +++ b/react-app/src/router.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from "@testing-library/react"; -import { RouterProvider } from "react-router"; -import { createMemoryRouter } from "react-router-dom"; +import { createMemoryRouter, RouterProvider } from "react-router"; import { describe, expect, it, vi } from "vitest"; import { router } from "./router"; From 031a7971585f0f8f057dd3aef0987207922dde7b Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Thu, 23 Jan 2025 14:20:44 -0500 Subject: [PATCH 10/12] reset timer back to original time --- react-app/src/components/TimeoutModal/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-app/src/components/TimeoutModal/index.tsx b/react-app/src/components/TimeoutModal/index.tsx index 9901177529..bf9a9e9bbc 100644 --- a/react-app/src/components/TimeoutModal/index.tsx +++ b/react-app/src/components/TimeoutModal/index.tsx @@ -14,7 +14,7 @@ import { intervalToDuration } from "date-fns"; import pluralize from "pluralize"; import { useEffect, useState } from "react"; -const TWENTY_MINS_IN_MILS = 1000 * 60 * 1; +const TWENTY_MINS_IN_MILS = 1000 * 60 * 20; const TEN_MINS_IN_MILS = 60 * 10; export const TimeoutModal = () => { From f4329b60c7173e7d2ccfdde476f57f7cd7df6719 Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Thu, 23 Jan 2025 15:14:22 -0500 Subject: [PATCH 11/12] update time for testing --- react-app/src/components/TimeoutModal/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-app/src/components/TimeoutModal/index.tsx b/react-app/src/components/TimeoutModal/index.tsx index bf9a9e9bbc..e078dce83b 100644 --- a/react-app/src/components/TimeoutModal/index.tsx +++ b/react-app/src/components/TimeoutModal/index.tsx @@ -14,7 +14,7 @@ import { intervalToDuration } from "date-fns"; import pluralize from "pluralize"; import { useEffect, useState } from "react"; -const TWENTY_MINS_IN_MILS = 1000 * 60 * 20; +const TWENTY_MINS_IN_MILS = 1000 * 60 * 10; const TEN_MINS_IN_MILS = 60 * 10; export const TimeoutModal = () => { From 082ee5ec7aaf1837f5a6163f54b1ebc636578412 Mon Sep 17 00:00:00 2001 From: Ty Bolt Date: Fri, 24 Jan 2025 14:57:16 -0500 Subject: [PATCH 12/12] switch timer back to default 20mins --- react-app/src/components/TimeoutModal/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-app/src/components/TimeoutModal/index.tsx b/react-app/src/components/TimeoutModal/index.tsx index e078dce83b..bf9a9e9bbc 100644 --- a/react-app/src/components/TimeoutModal/index.tsx +++ b/react-app/src/components/TimeoutModal/index.tsx @@ -14,7 +14,7 @@ import { intervalToDuration } from "date-fns"; import pluralize from "pluralize"; import { useEffect, useState } from "react"; -const TWENTY_MINS_IN_MILS = 1000 * 60 * 10; +const TWENTY_MINS_IN_MILS = 1000 * 60 * 20; const TEN_MINS_IN_MILS = 60 * 10; export const TimeoutModal = () => {