test(db): run the security, settings, tags and todo suites on the real database module

They reset through resetDatabase and seed through the ORM factories on the
booted app's ORM instead of the SQLite snapshot mock, so they run in the
Postgres lane as well.
This commit is contained in:
Maurice
2026-11-17 18:06:52 +01:00
parent e083e2d480
commit 11013711d6
6 changed files with 104 additions and 122 deletions
-4
View File
@@ -60,12 +60,8 @@
"tests/integration/legacy-upgrade-v244.test.ts": 1,
"tests/integration/plugins/boot-registry-order.test.ts": 1,
"tests/integration/plugins/plugin-runtime.test.ts": 1,
"tests/integration/security.test.ts": 1,
"tests/integration/settings.test.ts": 1,
"tests/integration/share.test.ts": 1,
"tests/integration/systemNotices.test.ts": 1,
"tests/integration/tags.test.ts": 1,
"tests/integration/todo.test.ts": 1,
"tests/integration/trip-access-primitives.test.ts": 1,
"tests/integration/trips.test.ts": 1,
"tests/integration/vacay.test.ts": 1,
+19 -23
View File
@@ -8,15 +8,16 @@
* - These tests focus on HTTP-level security: headers, auth, injection protection, etc.
*/
import { buildApp } from '../../src/bootstrap';
import { db as testDb } from '../../src/db/database';
import { AuditLog } from '../../src/db/entities/AuditLog.entity';
import { TripFiles } from '../../src/db/entities/TripFiles.entity';
import { authCookie, authHeader, generateToken } from '../helpers/auth';
import { createUser, createTrip } from '../helpers/factories';
import type { FactoryOrm } from '../helpers/factories/context';
import { findRows, updateRows } from '../helpers/factories/rows';
import { setAppSetting } from '../helpers/factories/settings';
import { makeTrip } from '../helpers/factories/trips';
import { makeUser } from '../helpers/factories/users';
import { readUser } from '../helpers/factories/users';
import { resetDatabase } from '../helpers/reset-database';
import { resetTestDb, resetRateLimits } from '../helpers/test-db';
import { MikroORM } from '@mikro-orm/core';
import type { INestApplication } from '@nestjs/common';
@@ -25,42 +26,37 @@ import type { Application } from 'express';
import fs from 'fs';
import path from 'path';
import request from 'supertest';
import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';
vi.mock('../../src/db/database', async () => {
const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');
return buildDbMock(createSnapshotTestDb());
});
import { describe, it, expect, beforeAll, beforeEach, afterAll } from 'vitest';
let nestApp: INestApplication;
let app: Application;
/** The app's own ORM, which the factories seed and read through. */
const orm = (): FactoryOrm => nestApp.get(MikroORM);
let orm: FactoryOrm;
const FIXTURE_IMG = path.join(__dirname, '../fixtures/small-image.jpg');
const uploadsDir = path.join(__dirname, '../../uploads/files');
beforeAll(async () => {
nestApp = await buildApp();
orm = nestApp.get(MikroORM);
app = nestApp.getHttpAdapter().getInstance();
if (!fs.existsSync(uploadsDir)) fs.mkdirSync(uploadsDir, { recursive: true });
await setAppSetting(orm(), 'allowed_file_types', '*');
await setAppSetting(orm, 'allowed_file_types', '*');
});
beforeEach(async () => {
resetTestDb(testDb);
await resetDatabase(orm);
await resetRateLimits(nestApp);
await setAppSetting(orm(), 'allowed_file_types', '*');
await setAppSetting(orm, 'allowed_file_types', '*');
});
afterAll(async () => {
await nestApp.close();
fs.rmSync(uploadsDir, { recursive: true, force: true });
testDb.close();
});
describe('Authentication security', () => {
it('SEC-007 — invalid JWT in Authorization Bearer header is rejected', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const token = generateToken(user.id);
// The file download endpoint accepts bearer auth
@@ -96,19 +92,19 @@ describe('Security headers', () => {
describe('API key encryption', () => {
it('SEC-008 — encrypted API keys are stored with enc:v1: prefix', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
await request(app)
.put('/api/auth/me/api-keys')
.set('Cookie', authCookie(user.id))
.send({ openweather_api_key: 'test-api-key-12345' });
const row = await readUser(orm(), user.id);
const row = await readUser(orm, user.id);
expect(row.openweather_api_key).toMatch(/^enc:v1:/);
});
it('SEC-008 — saving keys audits the names and never the values (#1939)', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const save = () =>
request(app)
@@ -121,7 +117,7 @@ describe('API key encryption', () => {
// changedKeys is internal: the client body is what it always was.
expect(first.body).not.toHaveProperty('changedKeys');
const rows = () => findRows(orm(), AuditLog, { action: 'settings.api_keys_update' });
const rows = () => findRows(orm, AuditLog, { action: 'settings.api_keys_update' });
expect(await rows()).toHaveLength(1);
expect((await rows())[0].details).toContain('openweather_api_key');
expect((await rows())[0].details).not.toContain('test-api-key-12345');
@@ -134,7 +130,7 @@ describe('API key encryption', () => {
});
it('SEC-008 — GET /api/auth/me does not return plaintext API key', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
await request(app)
.put('/api/auth/me/api-keys')
.set('Cookie', authCookie(user.id))
@@ -147,7 +143,7 @@ describe('API key encryption', () => {
describe('MFA secret protection', () => {
it('SEC-009 — GET /api/auth/me does not expose mfa_secret', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app).get('/api/auth/me').set('Cookie', authCookie(user.id));
expect(res.body.user.mfa_secret).toBeUndefined();
@@ -168,8 +164,8 @@ describe('Request body size limit', () => {
describe('File download path traversal', () => {
it('SEC-005 — path traversal in file download is blocked', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const upload = await request(app)
.post(`/api/trips/${trip.id}/files`)
@@ -178,7 +174,7 @@ describe('File download path traversal', () => {
expect(upload.status).toBe(201);
const fileId = upload.body.file.id;
await updateRows(orm(), TripFiles, { id: fileId }, { filename: '../../etc/passwd' });
await updateRows(orm, TripFiles, { id: fileId }, { filename: '../../etc/passwd' });
const res = await request(app).get(`/api/trips/${trip.id}/files/${fileId}/download`).set(authHeader(user.id));
// path.basename() strips traversal in the download controller; the normalized
+19 -20
View File
@@ -3,42 +3,41 @@
* Covers GET /api/settings, PUT /api/settings, POST /api/settings/bulk.
*/
import { buildApp } from '../../src/bootstrap';
import { db as testDb } from '../../src/db/database';
import { authCookie } from '../helpers/auth';
import { createUser } from '../helpers/factories';
import type { FactoryOrm } from '../helpers/factories/context';
import { makeUser } from '../helpers/factories/users';
import { resetDatabase } from '../helpers/reset-database';
import { resetTestDb, resetRateLimits } from '../helpers/test-db';
import { MikroORM } from '@mikro-orm/core';
import type { INestApplication } from '@nestjs/common';
import type { Application } from 'express';
import request from 'supertest';
import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';
vi.mock('../../src/db/database', async () => {
const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');
return buildDbMock(createSnapshotTestDb());
});
import { describe, it, expect, beforeAll, beforeEach, afterAll } from 'vitest';
let nestApp: INestApplication;
let app: Application;
// The booted app's own ORM, the one the requests write through.
let orm: FactoryOrm;
beforeAll(async () => {
nestApp = await buildApp();
orm = nestApp.get(MikroORM);
app = nestApp.getHttpAdapter().getInstance();
});
beforeEach(async () => {
resetTestDb(testDb);
await resetDatabase(orm);
await resetRateLimits(nestApp);
});
afterAll(async () => {
await nestApp.close();
testDb.close();
});
describe('Settings', () => {
it('SET-001: GET /api/settings returns empty object for new user', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app).get('/api/settings').set('Cookie', authCookie(user.id));
expect(res.status).toBe(200);
expect(res.body.settings).toBeDefined();
@@ -48,7 +47,7 @@ describe('Settings', () => {
});
it('SET-002: PUT /api/settings sets a key/value pair', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app)
.put('/api/settings')
.set('Cookie', authCookie(user.id))
@@ -60,7 +59,7 @@ describe('Settings', () => {
});
it('SET-003: PUT /api/settings updates an existing key', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
await request(app).put('/api/settings').set('Cookie', authCookie(user.id)).send({ key: 'theme', value: 'dark' });
const res = await request(app)
@@ -77,7 +76,7 @@ describe('Settings', () => {
});
it('SET-004: POST /api/settings/bulk upserts multiple settings', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app)
.post('/api/settings/bulk')
.set('Cookie', authCookie(user.id))
@@ -88,7 +87,7 @@ describe('Settings', () => {
});
it('SET-005: GET /api/settings reflects previously upserted values', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
await request(app)
.post('/api/settings/bulk')
.set('Cookie', authCookie(user.id))
@@ -106,14 +105,14 @@ describe('Settings', () => {
});
it('SET-007: PUT /api/settings without key returns 400', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app).put('/api/settings').set('Cookie', authCookie(user.id)).send({ value: 'dark' });
expect(res.status).toBe(400);
expect(res.body.error).toBeDefined();
});
it('SET-008: PUT /api/settings with masked value is ignored (no-op)', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
// First set a real value
await request(app)
.put('/api/settings')
@@ -130,7 +129,7 @@ describe('Settings', () => {
});
it('SET-009: POST /api/settings/bulk without settings object returns 400', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app)
.post('/api/settings/bulk')
.set('Cookie', authCookie(user.id))
@@ -139,8 +138,8 @@ describe('Settings', () => {
});
it('SET-010: settings are user-scoped (user A cannot see user B settings)', async () => {
const { user: userA } = createUser(testDb);
const { user: userB } = createUser(testDb);
const { user: userA } = await makeUser(orm);
const { user: userB } = await makeUser(orm);
await request(app)
.put('/api/settings')
+23 -24
View File
@@ -3,49 +3,48 @@
* Covers GET/POST/PUT/DELETE /api/tags.
*/
import { buildApp } from '../../src/bootstrap';
import { db as testDb } from '../../src/db/database';
import { authCookie } from '../helpers/auth';
import { createUser } from '../helpers/factories';
import type { FactoryOrm } from '../helpers/factories/context';
import { makeUser } from '../helpers/factories/users';
import { resetDatabase } from '../helpers/reset-database';
import { resetTestDb, resetRateLimits } from '../helpers/test-db';
import { MikroORM } from '@mikro-orm/core';
import type { INestApplication } from '@nestjs/common';
import type { Application } from 'express';
import request from 'supertest';
import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';
vi.mock('../../src/db/database', async () => {
const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');
return buildDbMock(createSnapshotTestDb());
});
import { describe, it, expect, beforeAll, beforeEach, afterAll } from 'vitest';
let nestApp: INestApplication;
let app: Application;
// The booted app's own ORM, the one the requests write through.
let orm: FactoryOrm;
beforeAll(async () => {
nestApp = await buildApp();
orm = nestApp.get(MikroORM);
app = nestApp.getHttpAdapter().getInstance();
});
beforeEach(async () => {
resetTestDb(testDb);
await resetDatabase(orm);
await resetRateLimits(nestApp);
});
afterAll(async () => {
await nestApp.close();
testDb.close();
});
describe('Tags', () => {
it('TAG-001: GET /api/tags returns empty array for new user', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app).get('/api/tags').set('Cookie', authCookie(user.id));
expect(res.status).toBe(200);
expect(res.body.tags).toEqual([]);
});
it('TAG-002: POST /api/tags creates a tag with default color', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app).post('/api/tags').set('Cookie', authCookie(user.id)).send({ name: 'Must See' });
expect(res.status).toBe(201);
expect(res.body.tag).toMatchObject({ name: 'Must See', user_id: user.id });
@@ -54,7 +53,7 @@ describe('Tags', () => {
});
it('TAG-003: POST /api/tags creates a tag with a custom color', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app)
.post('/api/tags')
.set('Cookie', authCookie(user.id))
@@ -64,14 +63,14 @@ describe('Tags', () => {
});
it('TAG-004: POST /api/tags without name returns 400', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app).post('/api/tags').set('Cookie', authCookie(user.id)).send({ color: '#ff0000' });
expect(res.status).toBe(400);
expect(res.body.error).toBeDefined();
});
it('TAG-005: PUT /api/tags/:id updates tag name and color', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const createRes = await request(app)
.post('/api/tags')
.set('Cookie', authCookie(user.id))
@@ -88,8 +87,8 @@ describe('Tags', () => {
});
it('TAG-006: PUT /api/tags/:id - tag belonging to another user returns 404', async () => {
const { user: userA } = createUser(testDb);
const { user: userB } = createUser(testDb);
const { user: userA } = await makeUser(orm);
const { user: userB } = await makeUser(orm);
const createRes = await request(app)
.post('/api/tags')
.set('Cookie', authCookie(userA.id))
@@ -105,7 +104,7 @@ describe('Tags', () => {
});
it('TAG-007: DELETE /api/tags/:id removes the tag', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const createRes = await request(app)
.post('/api/tags')
.set('Cookie', authCookie(user.id))
@@ -122,8 +121,8 @@ describe('Tags', () => {
});
it('TAG-008: DELETE /api/tags/:id - tag belonging to another user returns 404', async () => {
const { user: userA } = createUser(testDb);
const { user: userB } = createUser(testDb);
const { user: userA } = await makeUser(orm);
const { user: userB } = await makeUser(orm);
const createRes = await request(app)
.post('/api/tags')
.set('Cookie', authCookie(userA.id))
@@ -135,8 +134,8 @@ describe('Tags', () => {
});
it('TAG-009: Tags are user-scoped — user A cannot see user B tags', async () => {
const { user: userA } = createUser(testDb);
const { user: userB } = createUser(testDb);
const { user: userA } = await makeUser(orm);
const { user: userB } = await makeUser(orm);
await request(app).post('/api/tags').set('Cookie', authCookie(userA.id)).send({ name: 'User A Private Tag' });
const res = await request(app).get('/api/tags').set('Cookie', authCookie(userB.id));
@@ -150,14 +149,14 @@ describe('Tags', () => {
});
it('TAG-011: PUT /api/tags/abc - non-numeric id returns the legacy 404, not a 500 (Plan 3b Task 2 fix round, item 1b)', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app).put('/api/tags/abc').set('Cookie', authCookie(user.id)).send({ name: 'Ghost' });
expect(res.status).toBe(404);
expect(res.body).toEqual({ error: 'Tag not found' });
});
it('TAG-012: DELETE /api/tags/abc - non-numeric id returns the legacy 404, not a 500 (Plan 3b Task 2 fix round, item 1b)', async () => {
const { user } = createUser(testDb);
const { user } = await makeUser(orm);
const res = await request(app).delete('/api/tags/abc').set('Cookie', authCookie(user.id));
expect(res.status).toBe(404);
expect(res.body).toEqual({ error: 'Tag not found' });
+43 -47
View File
@@ -3,25 +3,22 @@
* Covers all endpoints at /api/trips/:tripId/todo.
*/
import { buildApp } from '../../src/bootstrap';
import { db as testDb } from '../../src/db/database';
import { TodoItems } from '../../src/db/entities/TodoItems.entity';
import { invalidatePermissionsCache } from '../../src/nest/permissions/permissions-cache';
import { authCookie } from '../helpers/auth';
import { createUser, createTrip, addTripMember } from '../helpers/factories';
import type { FactoryOrm } from '../helpers/factories/context';
import { findRows } from '../helpers/factories/rows';
import { addTripMember } from '../helpers/factories/trips';
import { makeTrip } from '../helpers/factories/trips';
import { makeUser } from '../helpers/factories/users';
import { resetDatabase } from '../helpers/reset-database';
import { resetTestDb, resetRateLimits } from '../helpers/test-db';
import { MikroORM } from '@mikro-orm/core';
import type { INestApplication } from '@nestjs/common';
import type { Application } from 'express';
import request from 'supertest';
import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';
vi.mock('../../src/db/database', async () => {
const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');
return buildDbMock(createSnapshotTestDb());
});
import { describe, it, expect, beforeAll, beforeEach, afterAll } from 'vitest';
let nestApp: INestApplication;
let app: Application;
@@ -34,28 +31,27 @@ beforeAll(async () => {
});
beforeEach(async () => {
resetTestDb(testDb);
await resetDatabase(orm);
await resetRateLimits(nestApp);
await invalidatePermissionsCache();
});
afterAll(async () => {
await nestApp.close();
testDb.close();
});
describe('Todo items', () => {
it('TODO-001: GET /api/trips/:id/todo returns empty items for a new trip', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const res = await request(app).get(`/api/trips/${trip.id}/todo`).set('Cookie', authCookie(user.id));
expect(res.status).toBe(200);
expect(res.body.items).toEqual([]);
});
it('TODO-002: POST /api/trips/:id/todo creates a todo with title only', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const res = await request(app)
.post(`/api/trips/${trip.id}/todo`)
.set('Cookie', authCookie(user.id))
@@ -66,8 +62,8 @@ describe('Todo items', () => {
});
it('TODO-003: POST /api/trips/:id/todo creates a todo with all optional fields', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const res = await request(app).post(`/api/trips/${trip.id}/todo`).set('Cookie', authCookie(user.id)).send({
name: 'Pack suitcase',
category: 'Preparation',
@@ -84,8 +80,8 @@ describe('Todo items', () => {
});
it('TODO-004: POST /api/trips/:id/todo - missing name returns 400', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const res = await request(app)
.post(`/api/trips/${trip.id}/todo`)
.set('Cookie', authCookie(user.id))
@@ -95,8 +91,8 @@ describe('Todo items', () => {
});
it('TODO-005: PUT /api/trips/:id/todo/:todoId toggles checked status', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const createRes = await request(app)
.post(`/api/trips/${trip.id}/todo`)
.set('Cookie', authCookie(user.id))
@@ -121,8 +117,8 @@ describe('Todo items', () => {
});
it('TODO-006: PUT /api/trips/:id/todo/:todoId updates category', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const createRes = await request(app)
.post(`/api/trips/${trip.id}/todo`)
.set('Cookie', authCookie(user.id))
@@ -138,8 +134,8 @@ describe('Todo items', () => {
});
it('TODO-007: DELETE /api/trips/:id/todo/:todoId deletes a todo', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const createRes = await request(app)
.post(`/api/trips/${trip.id}/todo`)
.set('Cookie', authCookie(user.id))
@@ -156,8 +152,8 @@ describe('Todo items', () => {
});
it('TODO-008: PUT /api/trips/:id/todo/reorder reorders items', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
// Create 3 items
const r1 = await request(app)
@@ -193,19 +189,19 @@ describe('Todo items', () => {
});
it('TODO-009: Non-member accessing trip returns 404', async () => {
const { user: owner } = createUser(testDb);
const { user: stranger } = createUser(testDb);
const trip = createTrip(testDb, owner.id);
const { user: owner } = await makeUser(orm);
const { user: stranger } = await makeUser(orm);
const trip = await makeTrip(orm, owner.id);
const res = await request(app).get(`/api/trips/${trip.id}/todo`).set('Cookie', authCookie(stranger.id));
expect(res.status).toBe(404);
});
it('TODO-010: Trip member can read and create todos', async () => {
const { user: owner } = createUser(testDb);
const { user: member } = createUser(testDb);
const trip = createTrip(testDb, owner.id);
addTripMember(testDb, trip.id, member.id);
const { user: owner } = await makeUser(orm);
const { user: member } = await makeUser(orm);
const trip = await makeTrip(orm, owner.id);
await addTripMember(orm, trip.id, member.id);
// Member can read
const getRes = await request(app).get(`/api/trips/${trip.id}/todo`).set('Cookie', authCookie(member.id));
@@ -220,8 +216,8 @@ describe('Todo items', () => {
});
it('TODO-011: PUT /api/trips/:id/todo/:todoId - non-existent item returns 404', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const res = await request(app)
.put(`/api/trips/${trip.id}/todo/99999`)
.set('Cookie', authCookie(user.id))
@@ -230,8 +226,8 @@ describe('Todo items', () => {
});
it('TODO-012: GET /api/trips/:id/todo - unauthenticated returns 401', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const res = await request(app).get(`/api/trips/${trip.id}/todo`);
expect(res.status).toBe(401);
});
@@ -239,8 +235,8 @@ describe('Todo items', () => {
describe('Todo category assignees', () => {
it('TODO-013: GET /api/trips/:id/todo/category-assignees returns empty object for new trip', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
const { user } = await makeUser(orm);
const trip = await makeTrip(orm, user.id);
const res = await request(app)
.get(`/api/trips/${trip.id}/todo/category-assignees`)
.set('Cookie', authCookie(user.id));
@@ -249,10 +245,10 @@ describe('Todo category assignees', () => {
});
it('TODO-014: PUT /api/trips/:id/todo/category-assignees/:name sets assignees', async () => {
const { user: owner } = createUser(testDb);
const { user: member } = createUser(testDb);
const trip = createTrip(testDb, owner.id);
addTripMember(testDb, trip.id, member.id);
const { user: owner } = await makeUser(orm);
const { user: member } = await makeUser(orm);
const trip = await makeTrip(orm, owner.id);
await addTripMember(orm, trip.id, member.id);
const res = await request(app)
.put(`/api/trips/${trip.id}/todo/category-assignees/Shopping`)
@@ -271,10 +267,10 @@ describe('Todo category assignees', () => {
});
it('TODO-015: PUT category-assignees with empty array clears assignees', async () => {
const { user: owner } = createUser(testDb);
const { user: member } = createUser(testDb);
const trip = createTrip(testDb, owner.id);
addTripMember(testDb, trip.id, member.id);
const { user: owner } = await makeUser(orm);
const { user: member } = await makeUser(orm);
const trip = await makeTrip(orm, owner.id);
await addTripMember(orm, trip.id, member.id);
// Set assignees
await request(app)
@@ -1,10 +1,6 @@
[
"tests/integration/security.test.ts",
"tests/integration/settings.test.ts",
"tests/integration/share.test.ts",
"tests/integration/systemNotices.test.ts",
"tests/integration/tags.test.ts",
"tests/integration/todo.test.ts",
"tests/integration/trip-access-primitives.test.ts",
"tests/integration/trips.test.ts",
"tests/integration/vacay.test.ts",