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.
This commit is contained in:
Ajax Davis 2026-01-14 01:32:06 +10:00
parent b6d507fcf5
commit d524d2ca16

View file

@ -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 {