Fix jest tests
Test / test (push) Successful in 33s Details

This commit is contained in:
Jeff 2024-09-25 13:02:52 -04:00
parent e438b5cb5b
commit b85be9cefe
3 changed files with 15 additions and 9 deletions

View File

@ -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(<RemixStub />)
await waitFor(() => screen.findByText<HTMLElement>(/Install/), {
timeout: 2000,
})
await waitFor(
() => screen.findByText<HTMLElement>(/Install Tack Up Now!/),
{
timeout: 2000,
}
)
expect(true).toBe(true)
})

View File

@ -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$": "<rootDir>/url-mock.js",
},
modulePathIgnorePatterns: ignorePatterns,
transform: {
@ -28,4 +29,4 @@ module.exports = {
setupFiles: [],
testEnvironment: "jsdom",
setupFilesAfterEnv: ["./setupTests.ts", "@testing-library/jest-dom"],
};
}

1
url-mock.js Normal file
View File

@ -0,0 +1 @@
export default "/path/to/something"