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(airtrail): one case per key field instead of a loop of awaits

Maurice8979bd1fcd4b
diff --git a/server/tests/unit/nest/airtrail.service.test.ts b/server/tests/unit/nest/airtrail.service.test.ts
index 67597bd72..f6aee5a47 100644
--- a/server/tests/unit/nest/airtrail.service.test.ts
+++ b/server/tests/unit/nest/airtrail.service.test.ts
@@ -93,17 +93,19 @@ describe('AirtrailService — at-rest encryption (3h L3)', () => {
describe('AirtrailService — the stored key stays with its host (GHSA-mwf5-5px8-c9h5)', () => {
const MASK = '••••••••';
- it('AIRTRAIL-SVC-HOST-001: a new host saved with the key masked or blank drops the stored key', async () => {
- for (const keyField of [MASK, '', undefined]) {
- const { user } = createUser(testDb);
- await svc.saveSettings(user.id, 'https://airtrail-a.example.test', 'key-for-a', false, false, null);
+ it.each([
+ ['masked', MASK],
+ ['blank', ''],
+ ['left out', undefined],
+ ])('AIRTRAIL-SVC-HOST-001: a new host saved with the key %s drops the stored key', async (_label, keyField) => {
+ const { user } = createUser(testDb);
+ await svc.saveSettings(user.id, 'https://airtrail-a.example.test', 'key-for-a', false, false, null);
- await svc.saveSettings(user.id, 'https://other-host.example.test', keyField, false, false, null);
+ await svc.saveSettings(user.id, 'https://other-host.example.test', keyField, false, false, null);
- expect(await rawAirtrailKey(user.id)).toBeNull();
- expect(await svc.getAirtrailCredentials(user.id)).toBeNull();
- expect((await readUser(t, user.id)).airtrail_url).toBe('https://other-host.example.test');
- }
+ expect(await rawAirtrailKey(user.id)).toBeNull();
+ expect(await svc.getAirtrailCredentials(user.id)).toBeNull();
+ expect((await readUser(t, user.id)).airtrail_url).toBe('https://other-host.example.test');
});
it('AIRTRAIL-SVC-HOST-002: a path edit on the same origin keeps the stored key', async () => {