diff --git a/client/src/App.test.jsx b/client/src/App.test.jsx deleted file mode 100644 index c4e01c0907..0000000000 --- a/client/src/App.test.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import { createRoot } from "react-dom/client"; -import { act } from "react-dom/test-utils"; -import { Provider } from "react-redux"; -import { describe, it } from "vitest"; - -import App from "./App"; -import { testClient as client } from "./api-client"; -import Router from "./components/router/Router"; -import { StateModel, globalSchema } from "./model"; -import { generateFakeUser } from "./user/User.test"; -import { createCoreApiVersionedUrlConfig } from "./utils/helpers/url"; - -describe("rendering", () => { - const model = new StateModel(globalSchema); - const params = { - WELCOME_PAGE: "Some text", - STATUSPAGE_ID: "5bce9beff4ca", - GATEWAY_URL: "https://renkulab.io/api", - }; - const fakeLocation = { pathname: "" }; - - it("renders anonymous user without crashing", async () => { - const div = document.createElement("div"); - const root = createRoot(div); - const user = generateFakeUser(true); - - await act(async () => { - root.render( - - - - - - ); - }); - }); - - it("renders logged user without crashing", async () => { - const div = document.createElement("div"); - const root = createRoot(div); - const user = generateFakeUser(); - const coreApiVersionedUrlConfig = createCoreApiVersionedUrlConfig({ - coreApiVersion: "/", - }); - await act(async () => { - root.render( - - - - - - ); - }); - }); -}); diff --git a/client/src/dataset/Datasets.test.jsx b/client/src/dataset/Datasets.test.js similarity index 70% rename from client/src/dataset/Datasets.test.jsx rename to client/src/dataset/Datasets.test.js index 82c2c82b8c..aa6ada9e8c 100644 --- a/client/src/dataset/Datasets.test.jsx +++ b/client/src/dataset/Datasets.test.js @@ -23,71 +23,11 @@ * Tests for datasets function. */ -import { createMemoryHistory } from "history"; -import { createRoot } from "react-dom/client"; -import { act } from "react-dom/test-utils"; -import { Provider } from "react-redux"; import { describe, expect, it } from "vitest"; -import { testClient as client } from "../api-client"; -import MemoryRouter from "../components/router/MemoryRouter"; -import { StateModel, globalSchema } from "../model"; -import ShowDataset from "./Dataset.container"; import { mapDataset } from "./DatasetFunctions"; describe("Dataset functions", () => { - const model = new StateModel(globalSchema); - const fakeHistory = createMemoryHistory({ - initialEntries: ["/"], - initialIndex: 0, - }); - fakeHistory.push({ - pathname: "/projects", - search: "?page=1", - }); - const migration = { core: { versionUrl: "" } }; - const datasets = [ - { - title: "Test dataset title", - identifier: "79215657-4319-4fcf-82b9-58267f2a1db8", - name: "test-dataset-name", - created_at: "2021-06-04 04:20:24.287936+00:00", - creators: [ - { - name: "First, Creator", - email: null, - affiliation: "Some Affiliation", - }, - ], - }, - ]; - - it("renders dataset view without crashing", async () => { - const div = document.createElement("div"); - const root = createRoot(div); - await act(async () => { - root.render( - - - - - - ); - }); - }); - const core_dataset = { created_at: "01/01/2001", description: "some description for a dataset", diff --git a/client/src/notifications/Notifications.test.jsx b/client/src/notifications/Notifications.test.js similarity index 54% rename from client/src/notifications/Notifications.test.jsx rename to client/src/notifications/Notifications.test.js index 182097dcd2..99bd3a6b9f 100644 --- a/client/src/notifications/Notifications.test.jsx +++ b/client/src/notifications/Notifications.test.js @@ -23,19 +23,12 @@ * Tests for notifications */ -import { createRoot } from "react-dom/client"; -import { act } from "react-test-renderer"; -import { afterEach, beforeEach, describe, expect, it } from "vitest"; +import { describe, expect, it } from "vitest"; import { testClient as client } from "../api-client"; -import MemoryRouter from "../components/router/MemoryRouter"; import { StateModel, globalSchema } from "../model"; -import AppContext from "../utils/context/appContext"; -import NotificationsPage from "./Notifications.container"; -import { CloseToast } from "./Notifications.present"; import { NotificationsInfo } from "./Notifications.state"; -import NotificationsManager, { Notification } from "./NotificationsManager"; -import NotificationsMenu from "./NotificationsMenu"; +import NotificationsManager from "./NotificationsManager"; const fakeLocation = { pathname: "" }; @@ -120,121 +113,3 @@ describe("setup and use notification system", () => { ); }); }); - -const model = new StateModel(globalSchema); -const props = { client, model }; -const notifications = new NotificationsManager(model, client, fakeLocation); -addMultipleNotifications(notifications, 1); - -describe("rendering NotificationsPage", () => { - it("renders NotificationsPage", async () => { - const div = document.createElement("div"); - document.body.appendChild(div); - const root = createRoot(div); - await act(async () => { - root.render( - - - - - - ); - }); - }); -}); - -describe("rendering Notification", () => { - const notification = model.get("notifications.all")[0]; - const settings = model.get("notifications.toast"); - - // setup a DOM element as a render target and cleanup on exit - let div, root; - beforeEach(async () => { - await act(async () => { - div = document.createElement("div"); - document.body.appendChild(div); - root = createRoot(div); - }); - }); - afterEach(async () => { - await act(async () => { - root.unmount(div); - div.remove(); - div = null; - }); - }); - - it("renders Notification", async () => { - await act(async () => { - root.render( - - null} - /> - - ); - }); - - await act(async () => { - root.render( - - null} - /> - - ); - }); - - await act(async () => { - const closeToast = ( - true} /> - ); - - root.render( - - null} - closeToast={closeToast} - /> - - ); - }); - - await act(async () => { - root.render( - - - empty - - } - /> - - ); - }); - }); -}); - -describe("rendering NotificationsMenu", () => { - it("renders NotificationsMenu", async () => { - const div = document.createElement("div"); - const root = createRoot(div); - document.body.appendChild(div); - - await act(async () => { - root.render( - - - - ); - }); - }); -}); diff --git a/client/src/project/Project.test.jsx b/client/src/project/Project.test.js similarity index 65% rename from client/src/project/Project.test.jsx rename to client/src/project/Project.test.js index 3e840d3f7f..167e9b102d 100644 --- a/client/src/project/Project.test.jsx +++ b/client/src/project/Project.test.js @@ -23,29 +23,13 @@ * Tests for project. */ -import { createMemoryHistory } from "history"; -import { createRoot } from "react-dom/client"; -import { act } from "react-dom/test-utils"; -import { Provider } from "react-redux"; -import { afterEach, beforeEach, describe, expect, it } from "vitest"; +import { describe, expect, it } from "vitest"; import { testClient as client } from "../api-client"; -import MemoryRouter from "../components/router/MemoryRouter"; import { StateModel, globalSchema } from "../model"; -import { generateFakeUser } from "../user/User.test"; -import Project, { mapProjectFeatures, withProjectMapped } from "./Project"; +import { mapProjectFeatures } from "./Project"; import { filterPaths } from "./Project.present"; import { ProjectCoordinator } from "./Project.state"; -import { OverviewCommitsBody } from "./overview/ProjectOverview.present"; - -const fakeHistory = createMemoryHistory({ - initialEntries: ["/"], - initialIndex: 0, -}); -fakeHistory.push({ - pathname: "/projects", - search: "?page=1", -}); describe("test ProjectCoordinator related components", () => { const model = new StateModel(globalSchema); @@ -121,91 +105,6 @@ describe("test ProjectCoordinator related components", () => { ) ).toBeTruthy(); }); - - it("test withProjectMapped higher order function", async () => { - const div = document.createElement("div"); - const root = createRoot(div); - const categories = ["commits", "metadata"]; - const CommitsConnected = withProjectMapped(OverviewCommitsBody, categories); - - await act(async () => { - root.render( - - - - - - ); - }); - }); -}); - -describe("rendering", () => { - const anonymousUser = generateFakeUser(true); - const loggedUser = generateFakeUser(); - const model = new StateModel(globalSchema); - let div, root; - - beforeEach(async () => { - await act(async () => { - div = document.createElement("div"); - document.body.appendChild(div); - root = createRoot(div); - }); - }); - afterEach(async () => { - await act(async () => { - root.unmount(div); - div.remove(); - div = null; - }); - }); - - it("renders view without crashing for anonymous user", async () => { - await act(async () => { - root.render( - - - - - - ); - }); - }); - - it("renders view without crashing for logged user", async () => { - const div = document.createElement("div"); - const root = createRoot(div); - await act(async () => { - root.render( - - - - - - ); - }); - }); }); describe("new project actions", () => { diff --git a/client/src/project/ProjectSuggestActions.test.jsx b/client/src/project/ProjectSuggestActions.test.jsx deleted file mode 100644 index f23aa837ff..0000000000 --- a/client/src/project/ProjectSuggestActions.test.jsx +++ /dev/null @@ -1,244 +0,0 @@ -/*! - * Copyright 2023 - Swiss Data Science Center (SDSC) - * A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and - * Eidgenössische Technische Hochschule Zürich (ETHZ). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * incubator-renku-ui - * - * ProjectSuggestionActions.test.js - * Tests for project Suggestion Actions. - */ -import TestRenderer, { act } from "react-test-renderer"; -import { describe, expect, it } from "vitest"; - -import { ACCESS_LEVELS, testClient as client } from "../api-client"; -import MemoryRouter from "../components/router/MemoryRouter"; -import { StateModel, globalSchema, projectSchema } from "../model"; -import { - ProjectSuggestActions, - ProjectSuggestionDataset, - ProjectSuggestionReadme, -} from "./Project.present"; -import { ProjectCoordinator } from "./Project.state"; - -const getProjectSuggestionProps = ( - props, - loading = true, - commits = [], - commitsReadme = [], - datasets = [{}] -) => { - props.fetchReadmeCommits = () => commitsReadme; - if (commits) - props.commits = { fetched: true, fetching: !loading, list: commits }; - if (commitsReadme) - props.commitsReadme = { - fetched: true, - fetching: !loading, - list: commitsReadme, - }; - props.datasets.core.datasets = datasets; - props.externalUrl = "/gitlab/"; - props.newDatasetUrl = "new-dataset-url"; - props.lockStatus = { locked: false }; - if (loading) props.datasets.core.datasets = null; - - return props; -}; -describe("rendering ProjectSuggestActions", () => { - const model = new StateModel(globalSchema); - const projectCoordinator = new ProjectCoordinator( - client, - model.subModel("project") - ); - - const props = { - ...projectSchema.createInitialized(), - projectCoordinator, - model: {}, - fetchDatasets: () => { - // eslint-disable-line @typescript-eslint/ban-types - }, - metadata: { - accessLevel: ACCESS_LEVELS.MAINTAINER, - defaultBranch: "master", - id: 12345, - }, - }; - - it("Don't render if is loading data", async () => { - const allProps = getProjectSuggestionProps(props, true); - const component = TestRenderer.create( - - ); - expect(component.toJSON()).toBe(null); - }); - - it("Don't render if user is not a project maintainer", async () => { - const allProps = getProjectSuggestionProps(props, false); - allProps.metadata.accessLevel = ACCESS_LEVELS.GUEST; - const component = TestRenderer.create( - - ); - expect(component.toJSON()).toBe(null); - allProps.metadata.accessLevel = ACCESS_LEVELS.MAINTAINER; - }); - - it("only render readme suggestion when exist datasets", async () => { - const exampleCommit = [{ id: "abc", committed_date: "2021-01-01" }]; - const allProps = getProjectSuggestionProps( - props, - false, - exampleCommit, - exampleCommit, - [{}] - ); - let rendered; - // ProjectSuggestActions does not play well with js dom because of the transition -- use the underlying components - await act(async () => { - rendered = TestRenderer.create( - - <> - - - - - ); - }); - const testInstance = rendered.root; - const suggestions = testInstance.findAllByProps({ - className: "suggestionTitle", - }); - expect(suggestions.length).toBe(1); - expect(suggestions[0]?.children[0]).toBe("Edit README.md"); - }); - - it("only render dataset suggestion when exist more that 1 commit in readme", async () => { - const exampleCommits = [ - { id: "abc", committed_date: "2021-01-01" }, - { id: "def", committed_date: "2021-01-02" }, - ]; - const allProps = getProjectSuggestionProps( - props, - false, - exampleCommits, - exampleCommits, - [] - ); - let rendered; - // ProjectSuggestActions does not play well with js dom because of the transition -- use the underlying components - await act(async () => { - rendered = TestRenderer.create( - - <> - - - - - ); - }); - const testInstance = rendered.root; - const suggestions = testInstance.findAllByProps({ - className: "suggestionTitle", - }); - expect(suggestions.length).toBe(1); - expect(suggestions[0]?.children[0]).toBe("Add some datasets"); - }); - - it("render all suggestion when exist only that 1 readme commit and no datasets", async () => { - const exampleCommit = [{ id: "abc", committed_date: "2021-01-01" }]; - const allProps = getProjectSuggestionProps( - props, - false, - exampleCommit, - exampleCommit, - [] - ); - allProps.commits = { list: exampleCommit, fetched: true }; - allProps.commitsReadme = { list: exampleCommit, fetched: true }; - let rendered; - // ProjectSuggestActions does not play well with js dom because of the transition -- use the underlying components - await act(async () => { - rendered = TestRenderer.create( - - <> - - - - - ); - }); - const testInstance = rendered.root; - const suggestions = testInstance.findAllByProps({ - className: "suggestionTitle", - }); - expect(suggestions.length).toBe(2); - expect(suggestions[0]?.children[0]).toBe("Edit README.md"); - expect(suggestions[1]?.children[0]).toBe("Add some datasets"); - }); - - it("no render all suggestion when exist more than 4 commits", async () => { - const exampleCommits = [ - { id: "abc1", committed_date: "2021-01-01" }, - { id: "abc2", committed_date: "2021-01-02" }, - { id: "abc3", committed_date: "2021-01-03" }, - { id: "abc4", committed_date: "2021-01-04" }, - { id: "abc5", committed_date: "2021-01-05" }, - ]; - const exampleReadmeCommit = [{ id: "abc1", committed_date: "2021-01-01" }]; - const allProps = getProjectSuggestionProps( - props, - false, - exampleCommits, - exampleReadmeCommit, - [] - ); - allProps.commits = { list: exampleCommits, fetched: true }; - allProps.commitsReadme = { list: exampleReadmeCommit, fetched: true }; - let rendered; - await act(async () => { - rendered = TestRenderer.create( - - - - ); - }); - const testInstance = rendered.root; - const suggestions = testInstance.findAllByProps({ - className: "suggestionTitle", - }); - expect(suggestions.length).toBe(0); - }); - - it("Don't render if the project is locked", () => { - const exampleCommit = [{ id: "abc", committed_date: "2021-01-01" }]; - const allProps = getProjectSuggestionProps( - props, - false, - exampleCommit, - exampleCommit, - [] - ); - allProps.commits = { list: exampleCommit, fetched: true }; - allProps.commitsReadme = { list: exampleCommit, fetched: true }; - allProps.lockStatus.locked = true; - const component = TestRenderer.create( - - ); - expect(component.toJSON()).toBe(null); - }); -}); diff --git a/client/src/project/datasets/ProjectDatasets.test.jsx b/client/src/project/datasets/ProjectDatasets.test.jsx deleted file mode 100644 index a8f2edec12..0000000000 --- a/client/src/project/datasets/ProjectDatasets.test.jsx +++ /dev/null @@ -1,86 +0,0 @@ -/*! - * Copyright 2020 - Swiss Data Science Center (SDSC) - * A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and - * Eidgenössische Technische Hochschule Zürich (ETHZ). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * renku-ui - * - * ProjectDatasets.test.js - * Tests for datasets inside projects. - */ - -import { createMemoryHistory } from "history"; -import { createRoot } from "react-dom/client"; -import { Provider } from "react-redux"; -import { act } from "react-test-renderer"; -import { afterEach, beforeEach, describe, it, vi } from "vitest"; - -import { ACCESS_LEVELS, testClient as client } from "../../api-client"; -import MemoryRouter from "../../components/router/MemoryRouter"; -import { StateModel, globalSchema } from "../../model"; -import { generateFakeUser } from "../../user/User.test"; -import DatasetImport from "./import/index"; - -describe("rendering", () => { - const model = new StateModel(globalSchema); - let spy = null; - - const loggedUser = generateFakeUser(); - const fakeHistory = createMemoryHistory({ - initialEntries: ["/"], - initialIndex: 0, - }); - const migration = { core: { versionUrl: "" } }; - - fakeHistory.push({ - pathname: "/projects/namespace/project-name/datasets/new", - }); - - beforeEach(() => { - // ckeditor dumps some junk to the console.error. Ignore it. - spy = vi.spyOn(console, "error").mockImplementation(() => { - // eslint-disable-line @typescript-eslint/ban-types - }); - }); - - afterEach(() => { - spy.mockRestore(); - }); - - it("renders DatasetImport form without crashing", async () => { - const div = document.createElement("div"); - document.body.appendChild(div); - const root = createRoot(div); - await act(async () => { - root.render( - - - - - - ); - }); - }); -}); diff --git a/client/src/project/new/ProjectFork.test.jsx b/client/src/project/new/ProjectFork.test.jsx deleted file mode 100644 index 323eb02c10..0000000000 --- a/client/src/project/new/ProjectFork.test.jsx +++ /dev/null @@ -1,82 +0,0 @@ -/*! - * Copyright 2020 - Swiss Data Science Center (SDSC) - * A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and - * Eidgenössische Technische Hochschule Zürich (ETHZ). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * renku-ui - * - * ProjectNew.test.js - * New project test code. - */ - -import { createMemoryHistory } from "history"; -import { createRoot } from "react-dom/client"; -import { act } from "react-dom/test-utils"; -import { Provider } from "react-redux"; -import { describe, it } from "vitest"; - -import { testClient as client } from "../../api-client"; -import MemoryRouter from "../../components/router/MemoryRouter"; -import { StateModel, globalSchema } from "../../model"; -import { generateFakeUser } from "../../user/User.test"; -import AppContext from "../../utils/context/appContext"; -import { ForkProject } from "./index"; - -const fakeHistory = createMemoryHistory({ - initialEntries: ["/"], - initialIndex: 0, -}); -fakeHistory.push({ - pathname: "/projects", - search: "?page=1", -}); -const fakeLocation = { pathname: "" }; - -describe("rendering", () => { - const model = new StateModel(globalSchema); - const templates = { custom: false, repositories: [{}] }; - - const loggedUser = generateFakeUser(); - const appContext = { - client: client, - params: { TEMPLATES: templates, GATEWAY_URL: "https://renkulab.io/api" }, - location: fakeLocation, - }; - - it("renders ForkProject without crashing for logged user", async () => { - const div = document.createElement("div"); - // Fix UncontrolledTooltip error. https://github.com/reactstrap/reactstrap/issues/773 - document.body.appendChild(div); - const root = createRoot(div); - await act(async () => { - root.render( - - - - - - - - ); - }); - }); -}); diff --git a/client/src/project/overview/ProjectOverview.test.jsx b/client/src/project/overview/ProjectOverview.test.jsx deleted file mode 100644 index d4e3bd352c..0000000000 --- a/client/src/project/overview/ProjectOverview.test.jsx +++ /dev/null @@ -1,90 +0,0 @@ -/*! - * Copyright 2021 - Swiss Data Science Center (SDSC) - * A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and - * Eidgenössische Technische Hochschule Zürich (ETHZ). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * renku-ui - * - * ProjectOverview.test.js - * Tests for project overview. - */ - -import { createMemoryHistory } from "history"; -import { createRoot } from "react-dom/client"; -import { Provider } from "react-redux"; -import { act } from "react-test-renderer"; -import { describe, it } from "vitest"; - -import { ProjectOverviewCommits, ProjectOverviewStats } from "."; -import { testClient as client } from "../../api-client"; -import MemoryRouter from "../../components/router/MemoryRouter"; -import { StateModel, globalSchema } from "../../model"; -import { ProjectCoordinator } from "../Project.state"; - -const fakeHistory = createMemoryHistory({ - initialEntries: ["/"], - initialIndex: 0, -}); - -describe("rendering", () => { - const model = new StateModel(globalSchema); - const props = { - projectCoordinator: new ProjectCoordinator( - client, - model.subModel("project") - ), - }; - - it("renders ProjectOverviewCommits", async () => { - const div = document.createElement("div"); - document.body.appendChild(div); - const root = createRoot(div); - const allProps = { - history: fakeHistory, - location: fakeHistory.location, - ...props, - }; - await act(async () => { - root.render( - - - - - - ); - }); - }); - - it("renders ProjectOverviewStats", async () => { - const div = document.createElement("div"); - document.body.appendChild(div); - const root = createRoot(div); - const allProps = { - branches: [], - ...props, - }; - await act(async () => { - root.render( - - - - - - ); - }); - }); -}); diff --git a/client/src/statuspage/Statuspage.test.jsx b/client/src/statuspage/Statuspage.test.jsx deleted file mode 100644 index f3750c7eb8..0000000000 --- a/client/src/statuspage/Statuspage.test.jsx +++ /dev/null @@ -1,70 +0,0 @@ -/*! - * Copyright 2021 - Swiss Data Science Center (SDSC) - * A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and - * Eidgenössische Technische Hochschule Zürich (ETHZ). - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * renku-ui - * - * Statuspage.test.js - * Tests for statuspage code. - */ - -import { createRoot } from "react-dom/client"; -import { act } from "react-test-renderer"; -import { describe, it } from "vitest"; - -import { statuspage as fakeStatuspage } from "../api-client/test-samples"; -import MemoryRouter from "../components/router/MemoryRouter"; -import { StateModel, globalSchema } from "../model"; -import { StatuspageBanner, StatuspageDisplay } from "../statuspage"; - -function dummyStatusSummary() { - return { retrieved_at: new Date(), statuspage: fakeStatuspage, error: null }; -} - -describe("rendering", () => { - const model = new StateModel(globalSchema); - const statusSummary = dummyStatusSummary(); - model.subModel("statuspage").setObject(statusSummary); - const location = { pathname: "" }; - - it("renders StatuspageBanner", async () => { - const div = document.createElement("div"); - document.body.appendChild(div); - const root = createRoot(div); - await act(async () => { - root.render( - - - - ); - }); - }); - - it("renders StatuspageDetails", async () => { - const div = document.createElement("div"); - document.body.appendChild(div); - const root = createRoot(div); - await act(async () => { - root.render( - - - - ); - }); - }); -}); diff --git a/client/src/utils/Utils.test.jsx b/client/src/utils/Utils.test.jsx index 37278694f1..8799b19358 100644 --- a/client/src/utils/Utils.test.jsx +++ b/client/src/utils/Utils.test.jsx @@ -24,15 +24,10 @@ */ import { DateTime } from "luxon"; -import { createRoot } from "react-dom/client"; -import { act } from "react-test-renderer"; import { describe, expect, it } from "vitest"; -import { RefreshButton } from "../components/buttons/Button"; -import { CommitsUtils, CommitsView } from "../components/commits/Commits"; +import { CommitsUtils } from "../components/commits/Commits"; import { fixRelativePath } from "../components/markdown/RenkuMarkdownWithPathTranslation"; -import MemoryRouter from "../components/router/MemoryRouter"; -import { StateModel, globalSchema } from "../model"; import { convertUnicodeToAscii, formatBytes, @@ -44,45 +39,6 @@ import { } from "./helpers/HelperFunctions"; import { verifyTitleCharacters } from "./helpers/verifyTitleCharacters.utils"; -describe("Render React components and functions", () => { - it("render RefreshButton", async () => { - const div = document.createElement("div"); - const root = createRoot(div); - const fakeAction = () => { - return false; - }; - - await act(async () => { - root.render( - - - - ); - }); - }); - - it("render CommitsView", async () => { - const div = document.createElement("div"); - const root = createRoot(div); - const projectModel = new StateModel(globalSchema); - const commits = projectModel.get("project.commits"); - - await act(async () => { - root.render( - - - - ); - }); - }); -}); - describe("Commits functions", () => { const { ElementType, createDateObject, createCommitsObjects } = CommitsUtils; const COMMITS = [