Skip to content
Snippets Groups Projects
Commit c3c06d72 authored by Long (Jackson) Le's avatar Long (Jackson) Le
Browse files

code: mock react router hooks

parent 30f3c499
Loading
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import "@testing-library/jest-dom";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import { BrowserRouter } from "react-router-dom";
import axios from "axios";
import App from "../src/App";
// Mock the React Router hooks
vi.mock("react-router-dom", async () => {
const actual = await vi.importActual("react-router-dom");
return {
...actual,
useNavigate: () => vi.fn(),
};
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment