import Fastify from 'fastify'; import { MemoryDatastoreProvider } from '@bytelyst/datastore'; import { setProvider } from './lib/datastore.js'; export function resetMemoryDatastore(): void { const provider = new MemoryDatastoreProvider(); setProvider(provider); } export async function buildTestApp( routePlugin: (app: ReturnType) => Promise, ) { resetMemoryDatastore(); const app = Fastify({ logger: false }); await app.register(routePlugin, { prefix: '/api' }); await app.ready(); return app; } export const TEST_USER_ID = 'test-user-1'; export const TEST_PRODUCT_ID = 'notelett'; export function authHeader() { return { authorization: 'Bearer test-token' }; }