-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
22 additions
and
3 deletions.
There are no files selected for viewing
17 changes: 14 additions & 3 deletions
17
webapp/src/components/Functions/__tests__/Functions.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(<Functions />); | ||
|
||
// Assert the presence of the heading | ||
const headingElement = screen.getByText(/Functions/i); | ||
expect(headingElement).toBeInTheDocument(); | ||
|
||
const functionElements = screen.queryAllByRole("link"); | ||
expect(functionElements).toHaveLength(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters