Skip to content

Commit

Permalink
chores: updated testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubh942 committed Aug 10, 2024
1 parent 9301a03 commit 429b901
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
17 changes: 14 additions & 3 deletions webapp/src/components/Functions/__tests__/Functions.test.jsx
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);
});
8 changes: 8 additions & 0 deletions webapp/src/components/Stack/__tests__/Stack.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<Stack />);

Expand Down

0 comments on commit 429b901

Please sign in to comment.