The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
test(oauth): read the granted code without non-null assertions
Maurice19270adef8a0
diff --git a/server/tests/unit/nest/oauth.service.test.ts b/server/tests/unit/nest/oauth.service.test.tsindex ce6228acf..b576cdb9c 100644--- a/server/tests/unit/nest/oauth.service.test.ts+++ b/server/tests/unit/nest/oauth.service.test.ts@@ -454,20 +454,22 @@ describe('createAuthCode + consumeAuthCode', () => {it('a code mints tokens only while the password it was granted under holds', async () => {const { user } = createUser(testDb);const created = await makeClient(user.id);- const clientId = created.client!.client_id as string;- const grant = async () =>- (await consumeAuthCode(- (await createAuthCode({- passwordVersion: 0,- clientId,- userId: user.id,- redirectUri: 'https://example.com/callback',- scopes: ['trips:read'],- resource: null,- codeChallenge: 'abc123',- codeChallengeMethod: 'S256',- }))!,- ))!;+ const clientId = String(created.client?.client_id);+ const grant = async () => {+ const code = await createAuthCode({+ passwordVersion: 0,+ clientId,+ userId: user.id,+ redirectUri: 'https://example.com/callback',+ scopes: ['trips:read'],+ resource: null,+ codeChallenge: 'abc123',+ codeChallengeMethod: 'S256',+ });+ const pending = code ? await consumeAuthCode(code) : null;+ if (!pending) throw new Error('the code was not stored');+ return pending;+ };const kept = await svc.issueTokensForCode(await grant());expect(kept?.access_token).toEqual(expect.any(String));