AstrBot-Desktop/src/App.test.tsx

28 行
729 B
TypeScript

import { invoke } from "@tauri-apps/api/core";
import { render, screen } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { App } from "./App";
vi.mock("@tauri-apps/api/core", () => ({
invoke: vi.fn(),
}));
describe("App", () => {
beforeEach(() => {
vi.mocked(invoke).mockResolvedValue({
appVersion: "0.1.0-alpha.0",
platform: "windows",
rustCore: "ready",
protocolVersion: "desktop-v1alpha1",
});
});
it("renders the verified Rust bootstrap status", async () => {
render(<App />);
expect(await screen.findByText("ready")).toBeInTheDocument();
expect(screen.getByText("desktop-v1alpha1")).toBeInTheDocument();
});
});