From d524d2ca169018824e7d2654672a7d2d2c8320b4 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Wed, 14 Jan 2026 01:32:06 +1000 Subject: [PATCH] fix: use API key auth for test factories Session auth requires valid better-auth sessions which can't be created programmatically. Switch factories to use API key auth which is properly supported. --- .../web/src/test/integration/_helpers/test-context.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/web/src/test/integration/_helpers/test-context.ts b/apps/web/src/test/integration/_helpers/test-context.ts index 76bbcb5..3752b77 100644 --- a/apps/web/src/test/integration/_helpers/test-context.ts +++ b/apps/web/src/test/integration/_helpers/test-context.ts @@ -88,10 +88,10 @@ export function getTestContext(): IntegrationTestContext { // Create tracker const tracker = new TestDataTracker(); - // Create factories + // Create factories (use API key client since session auth requires better-auth sessions) const factories = { - agent: createAgentFactory(api, tracker), - collection: createCollectionFactory(api, tracker), + agent: createAgentFactory(apiKeyClient, tracker), + collection: createCollectionFactory(apiKeyClient, tracker), }; cachedContext = { @@ -143,9 +143,10 @@ export function createFreshTestContext(): IntegrationTestContext { const tracker = new TestDataTracker(); + // Use API key client for factories since session auth requires better-auth sessions const factories = { - agent: createAgentFactory(api, tracker), - collection: createCollectionFactory(api, tracker), + agent: createAgentFactory(apiKeyClient, tracker), + collection: createCollectionFactory(apiKeyClient, tracker), }; return {