Skip to content

Commit 7e6ef15

Browse files
authored
Added tests in pre-commit : (#3263)
* added tests in pre-commit * fixes
1 parent 798e422 commit 7e6ef15

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

lefthook.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,9 @@ pre-commit:
3030
pnpm fix_code_quality
3131
git add {staged_files}
3232
8_check_type_errors:
33-
run: pnpm check_type_errors
34-
piped: true
33+
run: pnpm check_type_errors
34+
9_check_tests:
35+
run: |
36+
set -e
37+
pnpm check_tests
38+
piped: true

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"push_drizzle_schema": "drizzle-kit push",
9191
"push_drizzle_test_schema": "drizzle-kit push --config=./test/drizzle.config.ts",
9292
"run_tests": "vitest --coverage",
93+
"check_tests": "vitest run",
9394
"start_development_server": "tsx watch ./src/index.ts",
9495
"start_development_server_with_debugger": "tsx watch --inspect=${API_DEBUGGER_HOST:-127.0.0.1}:${API_DEBUGGER_PORT:-9229} ./src/index.ts",
9596
"start_production_server": "pnpm build_production && node ./dist/index.js",

test/routes/graphql/gql.tada-cache.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,13 @@ declare module 'gql.tada' {
6060
TadaDocumentNode<{ createTag: { id: string; name: string | null; createdAt: string | null; organization: { id: string; name: string | null; createdAt: string | null; } | null; } | null; }, { input: { organizationId: string; name: string; folderId?: string | null | undefined; }; }, void>;
6161
"\n query Organization($input: QueryOrganizationInput!, $first: Int!) {\n organization(input: $input) {\n id\n name\n members(first: $first) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n ":
6262
TadaDocumentNode<{ organization: { id: string; name: string | null; members: { edges: ({ node: { id: string; name: string | null; } | null; } | null)[] | null; } | null; } | null; }, { first: number; input: { id: string; }; }, void>;
63+
"query Query_agendaItem($input: QueryAgendaItemInput!) {\n agendaItem(input: $input) {\n id\n name\n description\n duration\n key\n type\n }\n}":
64+
TadaDocumentNode<{ agendaItem: { id: string; name: string | null; description: string | null; duration: string | null; key: string | null; type: "general" | "note" | "scripture" | "song" | null; } | null; }, { input: { id: string; }; }, void>;
65+
"\n mutation Mutation_createAgendaFolder($input: MutationCreateAgendaFolderInput!) {\n createAgendaFolder(input: $input) {\n id\n name\n event {\n id\n }\n }\n }\n":
66+
TadaDocumentNode<{ createAgendaFolder: { id: string; name: string | null; event: { id: string; } | null; } | null; }, { input: { parentFolderId?: string | null | undefined; name: string; isAgendaItemFolder: boolean; eventId: string; }; }, void>;
67+
"\n mutation Mutation_createAgendaItem($input: MutationCreateAgendaItemInput!) {\n createAgendaItem(input: $input) {\n id\n name\n description\n duration\n type\n }\n }\n":
68+
TadaDocumentNode<{ createAgendaItem: { id: string; name: string | null; description: string | null; duration: string | null; type: "general" | "note" | "scripture" | "song" | null; } | null; }, { input: { type: "general" | "note" | "scripture" | "song"; name: string; key?: string | null | undefined; folderId: string; duration?: string | null | undefined; description?: string | null | undefined; }; }, void>;
69+
"\n mutation Mutation_deleteAgendaItem($input: MutationDeleteAgendaItemInput!) {\n deleteAgendaItem(input: $input) {\n id\n name\n }\n }\n":
70+
TadaDocumentNode<{ deleteAgendaItem: { id: string; name: string | null; } | null; }, { input: { id: string; }; }, void>;
6371
}
6472
}

vitest.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ export default defineConfig({
1919

2020
// // https://vitest.dev/config/#teardowntimeout,
2121
// teardownTimeout: 10000
22+
23+
hookTimeout: 30000, // 30 seconds for hooks
24+
pool: "threads", // for faster test execution and to avoid postgres max-limit error
2225
},
2326
});

0 commit comments

Comments
 (0)