Skip to content

Commit 7816e18

Browse files
maparentclaude
andcommitted
Add Vitest integration tests for website group invitation functions
Tests createGroup, createGroupInvitation, and acceptGroupInvitation end-to-end against the local Supabase instance. Also fixes a bug where createGroupInvitation was JSON.stringify-ing the JSONB payload, causing accept_group_invitation to silently return false. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6dfaf77 commit 7816e18

4 files changed

Lines changed: 643 additions & 57 deletions

File tree

apps/website/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"start": "next start",
1212
"lint": "eslint .",
1313
"lint:fix": "eslint . --fix",
14-
"check-types": "tsc --noEmit --skipLibCheck"
14+
"check-types": "tsc --noEmit --skipLibCheck",
15+
"test:integration": "vitest run --config vitest.integration.config.ts"
1516
},
1617
"dependencies": {
1718
"@repo/database": "workspace:*",
@@ -35,6 +36,8 @@
3536
},
3637
"devDependencies": {
3738
"@repo/eslint-config": "workspace:*",
39+
"dotenv": "^16.0.0",
40+
"vitest": "^4.0.0",
3841
"@repo/tailwind-config": "workspace:*",
3942
"@repo/types": "workspace:*",
4043
"@repo/typescript-config": "workspace:*",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import dotenv from "dotenv";
2+
import path from "path";
3+
4+
dotenv.config({
5+
path: path.resolve(__dirname, "../../../packages/database/.env.local"),
6+
});
7+
8+
if (process.env.SUPABASE_URL?.includes("supabase.co")) {
9+
throw new Error(
10+
"Integration tests must not run against production Supabase. Check SUPABASE_URL.",
11+
);
12+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { defineConfig } from "vitest/config";
2+
import path from "path";
3+
4+
export default defineConfig({
5+
test: {
6+
environment: "node",
7+
include: ["test/integration/**/*.test.ts"],
8+
exclude: ["scripts/**"],
9+
setupFiles: ["test/setup.integration.ts"],
10+
sequence: { concurrent: false },
11+
pool: "forks",
12+
maxWorkers: 1,
13+
tags: [
14+
{
15+
name: "database",
16+
description: "Tests requiring the database",
17+
},
18+
],
19+
},
20+
resolve: {
21+
alias: {
22+
"~": path.resolve(__dirname, "app"),
23+
},
24+
},
25+
});

0 commit comments

Comments
 (0)