34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
|
|
import { describe, it, expect, setSystemTime, beforeAll, afterAll } from "bun:test";
|
|
import { render, screen } from "@testing-library/react";
|
|
import { VehicleList } from "./VehicleList";
|
|
import { Vehicle } from "@/lib/api";
|
|
|
|
describe("VehicleList Component", () => {
|
|
it("should instantiate without runtime errors (smoke test)", () => {
|
|
// This primarily tests that all imports in VehicleList.tsx are resolvable
|
|
expect(VehicleList).toBeDefined();
|
|
});
|
|
|
|
it("should process vehicles without error", () => {
|
|
const vehicles: Vehicle[] = [{
|
|
vin: "TEST",
|
|
status: "Online",
|
|
currentVersion: "1.0",
|
|
lastHeartbeat: "2024-01-01T12:00:00Z",
|
|
groupId: null
|
|
}];
|
|
|
|
try {
|
|
// Now we can properly render the component which handles hooks correctly
|
|
render(<VehicleList vehicles={vehicles} groups={[]} />);
|
|
// Check if content renders (assuming "Fleet Overview" is present as per component code)
|
|
expect(screen.getByText("Fleet Overview")).toBeDefined();
|
|
expect(screen.getByText("TEST")).toBeDefined();
|
|
} catch (e) {
|
|
console.error(e);
|
|
throw e; // Fail test if render throws
|
|
}
|
|
});
|
|
});
|