Skip to content

Commit c8e930f

Browse files
committed
web: Fix test
1 parent 8973813 commit c8e930f

File tree

4 files changed

+216
-6
lines changed

4 files changed

+216
-6
lines changed

web/jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import nextJest from "next/jest.js";
1+
const nextJest = require("next/jest");
22

33
const TEST_REGEX = "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|js?|tsx?|ts?)$";
44

@@ -36,4 +36,4 @@ const customJestConfig = {
3636
};
3737

3838
// createJestConfig is exported in this way to ensure that next/jest can load the Next.js config which is async
39-
export default createJestConfig(customJestConfig);
39+
module.exports = createJestConfig(customJestConfig);

web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"uuid": "^11.1.0"
7676
},
7777
"devDependencies": {
78+
"@babel/core": "^7.28.0",
7879
"@electron/osx-sign": "^2.0.0",
7980
"@graphql-codegen/cli": "^5.0.5",
8081
"@graphql-codegen/fragment-matcher": "^5.1.0",
@@ -86,6 +87,7 @@
8687
"@testing-library/user-event": "^14.6.1",
8788
"@types/adm-zip": "^0",
8889
"@types/apollo-upload-client": "^17",
90+
"@types/babel__core": "^7",
8991
"@types/chance": "^1.1.5",
9092
"@types/diff": "^5.2.1",
9193
"@types/jest": "^29.5.6",

web/renderer/components/pageComponents/DatabasePage/ForDocs/NewDocPage/NewDocForm.test.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { MockedProvider } from "@apollo/client/testing";
2+
import { databaseDetailsMock } from "@components/util/NotDoltWrapper/mocks";
23
import useMockRouter, { actions } from "@hooks/useMockRouter";
34
import { RefParams } from "@lib/params";
45
import { setup } from "@lib/testUtils.test";
@@ -23,16 +24,19 @@ jest.mock("next/router", () => {
2324
const docTitle = "Add a doc";
2425

2526
describe("test NewDocForm", () => {
27+
beforeEach(() => {
28+
actions.push.mockClear();
29+
});
30+
2631
it("renders new doc form for no docs", async () => {
2732
useMockRouter(jestRouter, {});
2833
const { user } = setup(
29-
<MockedProvider mocks={[docsMock(params, [])]}>
34+
<MockedProvider mocks={[docsMock(params, []), databaseDetailsMock(true, false)]}>
3035
<NewDocForm params={params} />
3136
</MockedProvider>,
3237
);
3338

3439
expect(await screen.findByText(docTitle)).toBeVisible();
35-
expect(await screen.findByText("LICENSE")).toBeVisible();
3640

3741
const button = screen.getByText("Create");
3842
expect(button).toBeDisabled();
@@ -48,7 +52,7 @@ describe("test NewDocForm", () => {
4852

4953
const { href, as } = sqlQuery({
5054
...params,
51-
q: `REPLACE INTO dolt_docs VALUES ("LICENSE.md", "${markdown}")`,
55+
q: `REPLACE INTO dolt_docs VALUES ("AGENT.md", "${markdown}")`,
5256
});
5357
await waitFor(() => expect(actions.push).toHaveBeenCalledWith(href, as));
5458
});

0 commit comments

Comments
 (0)