Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(test): add vitest config and initial web unit tests

Tin05fe0fb340cf
diff --git a/apps/web/src/components/ui/separator.test.tsx b/apps/web/src/components/ui/separator.test.tsx
new file mode 100644
index 000000000..1199dcf6a
--- /dev/null
+++ b/apps/web/src/components/ui/separator.test.tsx
@@ -0,0 +1,10 @@
+import { render, screen } from "@testing-library/react";
+import { describe, expect, it } from "vitest";
+import { Separator } from "./separator";
+
+describe("Separator", () => {
+ it("renders a horizontal separator", () => {
+ render(<Separator />);
+ expect(screen.getByRole("separator")).toBeInTheDocument();
+ });
+});
diff --git a/apps/web/src/lib/cn.test.ts b/apps/web/src/lib/cn.test.ts
new file mode 100644
index 000000000..f6d4f8796
--- /dev/null
+++ b/apps/web/src/lib/cn.test.ts
@@ -0,0 +1,8 @@
+import { describe, expect, it } from "vitest";
+import { cn } from "./cn";
+
+describe("cn", () => {
+ it("merges tailwind classes and resolves conflicts", () => {
+ expect(cn("px-2 py-1", "px-4")).toBe("py-1 px-4");
+ });
+});
diff --git a/apps/web/src/test/setup.ts b/apps/web/src/test/setup.ts
new file mode 100644
index 000000000..f149f27ae
--- /dev/null
+++ b/apps/web/src/test/setup.ts
@@ -0,0 +1 @@
+import "@testing-library/jest-dom/vitest";
diff --git a/apps/web/vitest.config.ts b/apps/web/vitest.config.ts
new file mode 100644
index 000000000..1436465b5
--- /dev/null
+++ b/apps/web/vitest.config.ts
@@ -0,0 +1,20 @@
+import path from "node:path";
+import react from "@vitejs/plugin-react";
+import { defineConfig } from "vitest/config";
+
+export default defineConfig({
+ plugins: [react()],
+ test: {
+ environment: "jsdom",
+ setupFiles: ["./src/test/setup.ts"],
+ include: ["src/**/*.test.{ts,tsx}"],
+ coverage: {
+ enabled: false,
+ },
+ },
+ resolve: {
+ alias: {
+ "@": path.resolve(__dirname, "./src"),
+ },
+ },
+});