trip) add day/week trip views (#52)
All checks were successful
Build and Push Image / docker-build-and-push (push) Successful in 2m19s
All checks were successful
Build and Push Image / docker-build-and-push (push) Successful in 2m19s
Reviewed-on: #52 Co-authored-by: AI Agent <ai-agent@campbellwireless.net> Co-committed-by: AI Agent <ai-agent@campbellwireless.net>
This commit was merged in pull request #52.
This commit is contained in:
@@ -10,7 +10,17 @@ import { TEST_USERS } from './test-users.js';
|
||||
|
||||
dotenvConfig({ path: resolve(process.cwd(), '.env.test'), override: true });
|
||||
|
||||
const DB_PATH = resolve(process.cwd(), 'trips.test.db');
|
||||
function resolveDatabasePath(): string {
|
||||
const rawUrl = process.env.DATABASE_URL;
|
||||
if (rawUrl && rawUrl.startsWith('file:')) {
|
||||
const rawPath = rawUrl.slice('file:'.length);
|
||||
if (!rawPath) return resolve(process.cwd(), 'trips.test.db');
|
||||
return rawPath.startsWith('/') ? rawPath : resolve(process.cwd(), rawPath);
|
||||
}
|
||||
return resolve(process.cwd(), 'trips.test.db');
|
||||
}
|
||||
|
||||
const DB_PATH = resolveDatabasePath();
|
||||
|
||||
// Delete any existing test DB so we start clean each run
|
||||
for (const ext of ['', '-shm', '-wal']) {
|
||||
@@ -20,6 +30,7 @@ for (const ext of ['', '-shm', '-wal']) {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`[e2e] Using test database at ${DB_PATH}`);
|
||||
const db = new BunSqlite(DB_PATH);
|
||||
db.exec('PRAGMA foreign_keys = ON');
|
||||
|
||||
@@ -40,6 +51,7 @@ const dbWrapper = {
|
||||
}
|
||||
};
|
||||
|
||||
console.log('[e2e] Running migrations...');
|
||||
const { runMigrations } = await import('../../src/lib/server/db/migrations.js');
|
||||
runMigrations(dbWrapper);
|
||||
console.log('[e2e] Migrations complete.');
|
||||
@@ -53,6 +65,7 @@ async function hashPassword(password: string): Promise<string> {
|
||||
});
|
||||
}
|
||||
|
||||
console.log('[e2e] Creating test users...');
|
||||
const regularId = randomUUID();
|
||||
dbWrapper.run(
|
||||
`INSERT INTO users (id, username, full_name, email, auth_source) VALUES (?, ?, ?, ?, ?)`,
|
||||
|
||||
Reference in New Issue
Block a user