Files
TREK/server/tests/helpers/journey-share-repos.ts
T
Maurice 724c88c201 style: format server and shared with prettier
A mechanical prettier --write over server/src, server/tests, server/scripts
and shared/src with the workspaces' .prettierrc; nothing but layout and
import order changes, and every file keeps the same set of imports. shared
is formatted throughout and its format baseline is empty. The server
baseline keeps the 35 files that Prettier would grow past their lint:size
limit (they need a split first, which is not a formatting change), and the
generated entity files stay as their generator writes them.
2026-10-10 21:23:37 +02:00

28 lines
1.4 KiB
TypeScript

import { JourneyBooks } from '../../src/db/entities/JourneyBooks.entity';
import { JourneyShareTokens } from '../../src/db/entities/JourneyShareTokens.entity';
import type { JourneyBooksRepository } from '../../src/db/repositories/JourneyBooks.repository';
import type { JourneyShareTokensRepository } from '../../src/db/repositories/JourneyShareTokens.repository';
import { sharedTestOrm } from './test-uow';
import type Database from 'better-sqlite3';
/**
* Plan 3g Task 3 (`JourneyShareService`/`JourneyBookService`) test-only
* repository factories, bound to a suite's own better-sqlite3 handle via the
* SAME memoised `sharedTestOrm` (`test-uow.ts`) — same precedent
* `journey-repos.ts` (Task 1) documents for itself.
*
* A NEW file rather than an addition to `journey-repos.ts`: that file is
* Task 1/2's own (`JourneysRepository`/`JourneyContributorsRepository`/
* `JourneyTripsRepository`/`JourneyEntriesRepository`/`JourneyPhotosRepository`/
* `JourneyEntryPhotosRepository`), concurrently in flight when this task ran
* — this file only adds the two share/book-owned tables' factories.
*/
export function createTestJourneyShareTokensRepo(db: Database.Database): Promise<JourneyShareTokensRepository> {
return sharedTestOrm(db).then((t) => t.repo(JourneyShareTokens));
}
export function createTestJourneyBooksRepo(db: Database.Database): Promise<JourneyBooksRepository> {
return sharedTestOrm(db).then((t) => t.repo(JourneyBooks));
}