diff --git a/packages/web/components/DocMarkdown/index.test.tsx b/packages/web/components/DocMarkdown/index.test.tsx index e5fee59d..24b5b13c 100644 --- a/packages/web/components/DocMarkdown/index.test.tsx +++ b/packages/web/components/DocMarkdown/index.test.tsx @@ -1,10 +1,11 @@ import { MockedProvider } from "@apollo/client/testing"; import { DocType } from "@gen/graphql-types"; -import useMockRouter from "@hooks/useMockRouter"; +import useMockRouter, { actions } from "@hooks/useMockRouter"; import { RefParams } from "@lib/params"; import { setup } from "@lib/testUtils.test"; +import { sqlQuery } from "@lib/urls"; import { getDoc } from "@pageComponents/DatabasePage/ForDocs/DocList/mocks"; -import { render, screen } from "@testing-library/react"; +import { render, screen, waitFor } from "@testing-library/react"; import DocMarkdown from "."; const jestRouter = jest.spyOn(require("next/router"), "useRouter"); @@ -122,6 +123,10 @@ describe("test DocMarkdown", () => { expect(screen.getByLabelText("markdown-editor")).toBeVisible(); await user.click(screen.getByText("delete")); - expect(screen.getByText(`Delete ${docName}`)).toBeVisible(); + const { href, as } = sqlQuery({ + ...params, + q: `DELETE FROM dolt_docs WHERE doc_name="${docName}"`, + }); + await waitFor(() => expect(actions.push).toHaveBeenCalledWith(href, as)); }); }); diff --git a/packages/web/components/pageComponents/DatabasePage/ForDocs/NewDocForm/index.test.tsx b/packages/web/components/pageComponents/DatabasePage/ForDocs/NewDocForm/index.test.tsx index 22c6fa36..80c7203d 100644 --- a/packages/web/components/pageComponents/DatabasePage/ForDocs/NewDocForm/index.test.tsx +++ b/packages/web/components/pageComponents/DatabasePage/ForDocs/NewDocForm/index.test.tsx @@ -1,6 +1,4 @@ import { MockedProvider } from "@apollo/client/testing"; -import { DocType } from "@gen/graphql-types"; -import { getDocsQuery } from "@hooks/useEditDoc/utils"; import useMockRouter, { actions } from "@hooks/useMockRouter"; import { RefParams } from "@lib/params"; import { setup } from "@lib/testUtils.test"; @@ -50,7 +48,7 @@ describe("test NewDocForm", () => { const { href, as } = sqlQuery({ ...params, - q: getDocsQuery(DocType.License, markdown), + q: `INSERT INTO dolt_docs VALUES ("LICENSE.md", "${markdown}") ON DUPLICATE KEY UPDATE doc_text="${markdown}"`, }); await waitFor(() => expect(actions.push).toHaveBeenCalledWith(href, as)); });