Skip to content

armgit / TREK

Public Imported from GitHub
0

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.

test(server): assert the row exists before checking its stamped columns

Mauricedf10dc6ec278
diff --git a/server/tests/unit/nest/files.service.test.ts b/server/tests/unit/nest/files.service.test.ts
index 93a013a90..3493214d9 100644
--- a/server/tests/unit/nest/files.service.test.ts
+++ b/server/tests/unit/nest/files.service.test.ts
@@ -460,7 +460,9 @@ describe('toggleStarred / softDeleteFile / restoreFile', () => {
const file = await makeFile(trip.id, user.id);
await svc.softDeleteFile(file.id);
const row = await findRow(orm, TripFiles, { id: file.id });
- expect(row?.deleted_at).not.toBeNull();
+ // The row must still be there: a hard delete would leave findRow at null.
+ expect(row).not.toBeNull();
+ expect(row!.deleted_at).not.toBeNull();
});
it('FILE-SVC-021: restoreFile clears deleted_at and returns the formatted row', async () => {
diff --git a/server/tests/unit/nest/memories-access.service.test.ts b/server/tests/unit/nest/memories-access.service.test.ts
index 674245bc4..dd3fa2bd5 100644
--- a/server/tests/unit/nest/memories-access.service.test.ts
+++ b/server/tests/unit/nest/memories-access.service.test.ts
@@ -691,7 +691,8 @@ describe('updateSyncTimeForAlbumLink (MA9)', () => {
await access.updateSyncTimeForAlbumLink(String(linkId));
const row = await findRow(orm, TripAlbumLinks, { id: linkId });
- expect(row?.last_synced_at).not.toBeNull();
+ expect(row).not.toBeNull();
+ expect(row!.last_synced_at).not.toBeNull();
});
it('MEMACCESS-MA9-002: a non-canonical id is a silent no-op, matching a legacy UPDATE that matched zero rows', async () => {
diff --git a/server/tests/unit/nest/passkey.service.test.ts b/server/tests/unit/nest/passkey.service.test.ts
index c30309566..7e6fefc65 100644
--- a/server/tests/unit/nest/passkey.service.test.ts
+++ b/server/tests/unit/nest/passkey.service.test.ts
@@ -666,8 +666,9 @@ describe('passkeyLoginVerify', () => {
expect(decoded).toHaveProperty('pv');
const credRow = (await findRow(orm, WebauthnCredentials, { id: cred.id }));
- expect(credRow?.counter).toBe(6);
- expect(credRow?.last_used_at).not.toBeNull();
+ expect(credRow).not.toBeNull();
+ expect(credRow!.counter).toBe(6);
+ expect(credRow!.last_used_at).not.toBeNull();
const userRow = await readUser(orm, user.id);
expect(userRow.last_login).not.toBeNull();
expect(userRow.login_count).toBe(1);