diff --git a/app/root.test.tsx b/app/routes/_index.test.tsx similarity index 74% rename from app/root.test.tsx rename to app/routes/_index.test.tsx index f9ccd48..edb7944 100644 --- a/app/root.test.tsx +++ b/app/routes/_index.test.tsx @@ -2,8 +2,9 @@ import { act, render, screen, waitFor } from "@testing-library/react" import MatchMediaMock from "jest-matchmedia-mock" import { createRemixStub, RemixStubProps } from "@remix-run/testing" -import App from "./root" +import App from "../root" import React from "react" +import Index from "./_index" let RemixStub: (props: RemixStubProps) => React.JSX.Element describe("root", () => { @@ -13,8 +14,8 @@ describe("root", () => { path: "/", meta: () => [], links: () => [], - loader: () => ({ isSupported: true }), - Component: App, + loader: () => ({ isSupported: true, isMobileSafari: true }), + Component: Index, }, ]) }) @@ -35,9 +36,12 @@ describe("root", () => { test("they are instructed to install tack up now", async () => { render() - await waitFor(() => screen.findByText(/Install/), { - timeout: 2000, - }) + await waitFor( + () => screen.findByText(/Install Tack Up Now!/), + { + timeout: 2000, + } + ) expect(true).toBe(true) }) diff --git a/jest.config.ts b/jest.config.ts index f811af5..0650c6f 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -5,14 +5,15 @@ const ignorePatterns = [ "\\/\\.tmp\\/", "\\/\\.cache\\/", "data", - "e2e" -]; + "e2e", +] module.exports = { moduleNameMapper: { "^@web3-storage/multipart-parser$": require.resolve( "@web3-storage/multipart-parser" ), + "\\?url$": "/url-mock.js", }, modulePathIgnorePatterns: ignorePatterns, transform: { @@ -28,4 +29,4 @@ module.exports = { setupFiles: [], testEnvironment: "jsdom", setupFilesAfterEnv: ["./setupTests.ts", "@testing-library/jest-dom"], -}; \ No newline at end of file +} diff --git a/url-mock.js b/url-mock.js new file mode 100644 index 0000000..d4e22f6 --- /dev/null +++ b/url-mock.js @@ -0,0 +1 @@ +export default "/path/to/something"