diff --git a/webapp/src/components/Functions/__tests__/Functions.test.jsx b/webapp/src/components/Functions/__tests__/Functions.test.jsx index 085ae57..85bef10 100644 --- a/webapp/src/components/Functions/__tests__/Functions.test.jsx +++ b/webapp/src/components/Functions/__tests__/Functions.test.jsx @@ -1,11 +1,22 @@ import React from "react"; import { render, screen } from "@testing-library/react"; -import Functions from "../Functions.jsx"; // Adjust the import path as per your project structure +import Functions from "../Functions.jsx"; +import { vi } from "vitest"; -test("renders Functions component with correct heading and function names", () => { +vi.mock("../../../context/DataContext.jsx", () => ({ + DataState: () => ({ + refresh: false, + functions: [], + setFunctions: vi.fn(), + }), +})); + +test("renders Functions component with correct heading", () => { render(); - // Assert the presence of the heading const headingElement = screen.getByText(/Functions/i); expect(headingElement).toBeInTheDocument(); + + const functionElements = screen.queryAllByRole("link"); + expect(functionElements).toHaveLength(0); }); diff --git a/webapp/src/components/Stack/__tests__/Stack.test.jsx b/webapp/src/components/Stack/__tests__/Stack.test.jsx index 41e4dd1..321513b 100644 --- a/webapp/src/components/Stack/__tests__/Stack.test.jsx +++ b/webapp/src/components/Stack/__tests__/Stack.test.jsx @@ -2,6 +2,14 @@ import React from "react"; import { render, screen } from "@testing-library/react"; import Stack from "../Stack.jsx"; +vi.mock("../../../context/DataContext.jsx", () => ({ + DataState: () => ({ + refresh: false, + stack: [], + setStack: vi.fn(), + }), +})); + test("renders Stack component with stack items", () => { render();