Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✅ Set up unit testing in @rallly/ui and move markdown-description test (RAL-1332) (#2649)

Luke Vella4c2dad0e4f28
diff --git a/packages/ui/package.json b/packages/ui/package.json
index 1ba9dbb81..34af00e10 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -8,6 +8,7 @@
"check": "biome check .",
"check:fix": "biome check . --write",
"ui:add": "npx shadcn-ui@latest add",
+ "test:unit": "vitest run",
"type-check": "tsc --noEmit"
},
"exports": {
@@ -42,8 +43,12 @@
},
"devDependencies": {
"@rallly/tsconfig": "workspace:*",
+ "@testing-library/react": "^16.3.0",
"@types/react": "19.2.13",
"@types/react-dom": "19.2.3",
- "unified": "^11.0.5"
+ "@vitejs/plugin-react": "^5.0.0",
+ "jsdom": "^26.1.0",
+ "unified": "^11.0.5",
+ "vitest": "^4.0.16"
}
}
diff --git a/apps/web/src/features/poll/components/markdown-description.test.tsx b/packages/ui/src/markdown-description.test.tsx
similarity index 98%
rename from apps/web/src/features/poll/components/markdown-description.test.tsx
rename to packages/ui/src/markdown-description.test.tsx
index 9c7838688..7d4a4202d 100644
--- a/apps/web/src/features/poll/components/markdown-description.test.tsx
+++ b/packages/ui/src/markdown-description.test.tsx
@@ -1,6 +1,6 @@
-import { MarkdownDescription } from "@rallly/ui/markdown-description";
import { render } from "@testing-library/react";
import { describe, expect, it } from "vitest";
+import { MarkdownDescription } from "./markdown-description";
function renderMarkdown(content: string) {
const { container } = render(<MarkdownDescription content={content} />);
diff --git a/packages/ui/vitest.config.mts b/packages/ui/vitest.config.mts
new file mode 100644
index 000000000..32cb08157
--- /dev/null
+++ b/packages/ui/vitest.config.mts
@@ -0,0 +1,10 @@
+import react from "@vitejs/plugin-react";
+import { defineConfig } from "vitest/config";
+
+export default defineConfig({
+ plugins: [react()],
+ test: {
+ environment: "jsdom",
+ include: ["src/**/*.test.{ts,tsx}"],
+ },
+});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6a0ba62d1..76820ad38 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -825,15 +825,27 @@ importers:
'@rallly/tsconfig':
specifier: workspace:*
version: link:../tsconfig
+ '@testing-library/react':
+ specifier: ^16.3.0
'@types/react':
specifier: 19.2.13
version: 19.2.13
'@types/react-dom':
specifier: 19.2.3
version: 19.2.3(@types/[email protected])
+ '@vitejs/plugin-react':
+ specifier: ^5.0.0
+ jsdom:
+ specifier: ^26.1.0
+ version: 26.1.0
unified:
specifier: ^11.0.5
version: 11.0.5
+ vitest:
+ specifier: ^4.0.16
packages/utils:
dependencies: