diff options
| author | Mohamed Bassem <me@mbassem.com> | 2024-12-30 16:55:49 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2024-12-30 16:56:23 +0000 |
| commit | 058e7238840b362135fd080045478025e31bf720 (patch) | |
| tree | f094b35163961065d3d145e8ff826219b0bb3506 /packages/e2e_tests/utils/trpc.ts | |
| parent | 5aee3404aa7f446a221a88c9b2cd529d1249e22f (diff) | |
| download | karakeep-058e7238840b362135fd080045478025e31bf720.tar.zst | |
chore: Setup and add e2e tests for the API endpoints
Diffstat (limited to 'packages/e2e_tests/utils/trpc.ts')
| -rw-r--r-- | packages/e2e_tests/utils/trpc.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/e2e_tests/utils/trpc.ts b/packages/e2e_tests/utils/trpc.ts new file mode 100644 index 00000000..7d916d93 --- /dev/null +++ b/packages/e2e_tests/utils/trpc.ts @@ -0,0 +1,20 @@ +import { createTRPCClient, httpBatchLink } from "@trpc/client"; +import superjson from "superjson"; + +import type { AppRouter } from "@hoarder/trpc/routers/_app"; + +export function getTrpcClient(apiKey?: string) { + return createTRPCClient<AppRouter>({ + links: [ + httpBatchLink({ + transformer: superjson, + url: `http://localhost:${process.env.HOARDER_PORT}/api/trpc`, + headers() { + return { + authorization: apiKey ? `Bearer ${apiKey}` : undefined, + }; + }, + }), + ], + }); +} |
