mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 09:38:54 +00:00
fix(settings): drop dead wiring and the speculative deleteForUser; strict row assertions
This commit is contained in:
@@ -128,15 +128,13 @@ export function createTestSettingsRepo(db: Database.Database): Promise<SettingsR
|
||||
}
|
||||
|
||||
/**
|
||||
* The `UsersRepository` `instance-api-keys.ts`'s repository-backed functions
|
||||
* resolve through the active MikroORM request context rather than a
|
||||
* constructor argument (Plan 3a Task 5 — see the file's own docstring for
|
||||
* why: its callers span ~6 domains outside this plan, still passing
|
||||
* `DatabaseService`, and none of them are touched by this conversion). A
|
||||
* hand-built test that exercises those functions still needs a real
|
||||
* `UsersRepository` bound to the same ORM its `withRequestContext`-style
|
||||
* wrapper forks from — this is that repository, same memoisation as the
|
||||
* others in this file.
|
||||
* The `UsersRepository` a hand-constructed service passes into
|
||||
* `instance-api-keys.ts`'s `resolveApiKey` (and the other functions there
|
||||
* that take one) — an explicit parameter, not resolved off an ambient
|
||||
* MikroORM request context (Plan 3a Task 5; an earlier version of that file
|
||||
* tried the request-context approach and broke 185 unit tests across 12
|
||||
* files that build a service with no request context around it — see that
|
||||
* file's own docstring). Same memoisation as the others in this file.
|
||||
*/
|
||||
export function createTestUsersRepo(db: Database.Database): Promise<UsersRepository> {
|
||||
const existing = usersPerHandle.get(db);
|
||||
|
||||
@@ -470,23 +470,6 @@ describe('Tool: search_cover_images', () => {
|
||||
})));
|
||||
}
|
||||
|
||||
// UnsplashService.getUnsplashKey resolves through instance-api-keys.ts's
|
||||
// resolveApiKey (Plan 3a Task 5), which now reads AppSettingsRepository/
|
||||
// UsersRepository off the active MikroORM request context when the caller
|
||||
// has no repository of its own to pass — this in-memory MCP harness
|
||||
// (mcp-test-controllers.ts) builds every controller by hand with no HTTP
|
||||
// request around it, so there is no such context here (unlike buildApp()'s
|
||||
// real e2e/production path, or a DI-injected repository test like
|
||||
// AppSettingsRepository's own, both of which are covered elsewhere).
|
||||
// These two tests are about the SEARCH RESULT handling (parsing Unsplash's
|
||||
// response into photos / an error), not the key-resolution precedence
|
||||
// (env > instance > user row), which unsplash.service.test.ts's own
|
||||
// getUnsplashKey suite already covers directly — so an operator env key
|
||||
// here short-circuits resolveApiKey before it ever needs that context,
|
||||
// without losing any coverage this describe block is actually for.
|
||||
beforeEach(() => { process.env.UNSPLASH_ACCESS_KEY = 'operator-test-key'; });
|
||||
afterEach(() => { delete process.env.UNSPLASH_ACCESS_KEY; });
|
||||
|
||||
it('returns the photo candidates for a query', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
stubUnsplash({
|
||||
|
||||
Reference in New Issue
Block a user