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(db): run the atlas and backup suites on the real database module

Maurice8c1395c8f101
diff --git a/server/scripts/test-mocks-baseline.json b/server/scripts/test-mocks-baseline.json
index e9d9ca8a8..3aaf34212 100644
--- a/server/scripts/test-mocks-baseline.json
+++ b/server/scripts/test-mocks-baseline.json
@@ -53,9 +53,7 @@
"tests/e2e/vacay.e2e.test.ts": 1,
"tests/e2e/weather.e2e.test.ts": 1,
"tests/integration/admin.test.ts": 1,
- "tests/integration/atlas.test.ts": 1,
"tests/integration/auth.test.ts": 1,
- "tests/integration/backup.test.ts": 1,
"tests/integration/collab.test.ts": 1,
"tests/integration/dayReorder.test.ts": 1,
"tests/integration/files.test.ts": 1,
diff --git a/server/tests/integration/atlas.test.ts b/server/tests/integration/atlas.test.ts
index f70050545..044f891ba 100644
--- a/server/tests/integration/atlas.test.ts
+++ b/server/tests/integration/atlas.test.ts
@@ -3,14 +3,15 @@
* Covers ATLAS-001 to ATLAS-008.
*/
import { buildApp } from '../../src/bootstrap';
-import { db as testDb } from '../../src/db/database';
import { PlaceRegions } from '../../src/db/entities/PlaceRegions.entity';
import { authCookie } from '../helpers/auth';
-import { createUser, createTrip } from '../helpers/factories';
import type { FactoryOrm } from '../helpers/factories/context';
import { makePlace } from '../helpers/factories/places';
import { findRow } from '../helpers/factories/rows';
-import { resetTestDb, resetRateLimits } from '../helpers/test-db';
+import { makeTrip } from '../helpers/factories/trips';
+import { makeUser } from '../helpers/factories/users';
+import { resetDatabase } from '../helpers/reset-database';
+import { resetRateLimits } from '../helpers/test-db';
import { MikroORM } from '@mikro-orm/core';
import type { INestApplication } from '@nestjs/common';
@@ -18,11 +19,6 @@ 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());
-});
-
let nestApp: INestApplication;
let app: Application;
/** The app's own ORM, which the factories seed and read through. */
@@ -55,19 +51,18 @@ beforeAll(async () => {
}, 60_000);
beforeEach(async () => {
- resetTestDb(testDb);
+ await resetDatabase(orm());
await resetRateLimits(nestApp);
});
afterAll(async () => {
vi.unstubAllGlobals();
await nestApp.close();
- testDb.close();
});
describe('Atlas stats', () => {
it('ATLAS-001 — GET /api/atlas/stats returns stats object', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app).get('/api/addons/atlas/stats').set('Cookie', authCookie(user.id));
expect(res.status).toBe(200);
@@ -76,11 +71,19 @@ describe('Atlas stats', () => {
});
it('ATLAS-014 — a future trip is returned as planned and excluded from totalCountries (#1048)', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
// Offsets from today rather than literal dates, so this cannot expire.
const iso = (days: number) => new Date(Date.now() + days * 86_400_000).toISOString().slice(0, 10);
- const past = createTrip(testDb, user.id, { title: 'Rome, last month', start_date: iso(-40), end_date: iso(-30) });
- const future = createTrip(testDb, user.id, { title: 'Tokyo, next month', start_date: iso(30), end_date: iso(40) });
+ const past = await makeTrip(orm(), user.id, {
+ title: 'Rome, last month',
+ start_date: iso(-40),
+ end_date: iso(-30),
+ });
+ const future = await makeTrip(orm(), user.id, {
+ title: 'Tokyo, next month',
+ start_date: iso(30),
+ end_date: iso(40),
+ });
// No coordinates and no category: the country has to come from the address.
const unplaced = { lat: null, lng: null, category: null };
await makePlace(orm(), past.id, { ...unplaced, name: 'Colosseum', address: 'Piazza del Colosseo, Rome, Italy' });
@@ -99,7 +102,7 @@ describe('Atlas stats', () => {
});
it('ATLAS-002 — GET /api/atlas/country/:code returns places in country', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app).get('/api/addons/atlas/country/FR').set('Cookie', authCookie(user.id));
expect(res.status).toBe(200);
@@ -109,7 +112,7 @@ describe('Atlas stats', () => {
describe('Mark/unmark country', () => {
it('ATLAS-003 — POST /country/:code/mark marks country as visited', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app).post('/api/addons/atlas/country/DE/mark').set('Cookie', authCookie(user.id));
expect(res.status).toBe(200);
@@ -122,7 +125,7 @@ describe('Mark/unmark country', () => {
});
it('ATLAS-004 — DELETE /country/:code/mark unmarks country', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
await request(app).post('/api/addons/atlas/country/IT/mark').set('Cookie', authCookie(user.id));
@@ -134,7 +137,7 @@ describe('Mark/unmark country', () => {
describe('Bucket list', () => {
it('ATLAS-005 — POST /bucket-list creates a bucket list item', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app)
.post('/api/addons/atlas/bucket-list')
@@ -145,7 +148,7 @@ describe('Bucket list', () => {
});
it('ATLAS-005 — POST without name returns 400', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app)
.post('/api/addons/atlas/bucket-list')
@@ -155,7 +158,7 @@ describe('Bucket list', () => {
});
it('ATLAS-005 — POST the same item twice returns 409 and keeps one row (#1898)', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const body = { name: 'Japan', country_code: 'JP' };
const first = await request(app)
@@ -176,7 +179,7 @@ describe('Bucket list', () => {
});
it('ATLAS-005 — POST the same item for another target date is allowed (#1898)', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const undated = await request(app)
.post('/api/addons/atlas/bucket-list')
@@ -195,7 +198,7 @@ describe('Bucket list', () => {
});
it('ATLAS-006 — GET /bucket-list returns items', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
await request(app)
.post('/api/addons/atlas/bucket-list')
@@ -208,7 +211,7 @@ describe('Bucket list', () => {
});
it('ATLAS-007 — PUT /bucket-list/:id updates item', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const create = await request(app)
.post('/api/addons/atlas/bucket-list')
@@ -225,7 +228,7 @@ describe('Bucket list', () => {
});
it('ATLAS-007 — PUT onto an existing wish returns 409 and leaves the row alone (#1898)', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
await request(app)
.post('/api/addons/atlas/bucket-list')
.set('Cookie', authCookie(user.id))
@@ -247,7 +250,7 @@ describe('Bucket list', () => {
});
it('ATLAS-008 — DELETE /bucket-list/:id removes item', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const create = await request(app)
.post('/api/addons/atlas/bucket-list')
@@ -264,7 +267,7 @@ describe('Bucket list', () => {
});
it('ATLAS-008 — DELETE non-existent item returns 404', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app).delete('/api/addons/atlas/bucket-list/99999').set('Cookie', authCookie(user.id));
expect(res.status).toBe(404);
@@ -273,7 +276,7 @@ describe('Bucket list', () => {
describe('Mark/unmark region', () => {
it('ATLAS-009 — POST /region/:code/mark marks a region as visited', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -285,7 +288,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-009 — POST /region/:code/mark without name returns 400', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -296,7 +299,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-009 — POST /region/:code/mark without country_code returns 400', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -307,7 +310,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-009 — marking a region also auto-marks the parent country', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -321,7 +324,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-009 — marking the same region twice is idempotent', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -337,7 +340,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-010 — GET /regions returns marked regions grouped by country', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -361,7 +364,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-011 — DELETE /region/:code/mark unmarks a region', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -381,7 +384,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-011 — unmark last region in country also unmarks the parent country', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -397,7 +400,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-011 — unmark one region keeps country when another region remains', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -418,7 +421,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-011: unmark last region keeps a country the user marked visited itself (#2597)', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const cookie = authCookie(user.id);
await request(app).post('/api/addons/atlas/country/NO/mark').set('Cookie', cookie);
@@ -437,7 +440,7 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-011: a country first reached through a region stays once it is marked itself (#2597)', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const cookie = authCookie(user.id);
await request(app)
@@ -455,8 +458,8 @@ describe('Mark/unmark region', () => {
});
it('ATLAS-011 — regions are isolated between users', async () => {
- const { user: user1 } = createUser(testDb);
- const { user: user2 } = createUser(testDb);
+ const { user: user1 } = await makeUser(orm());
+ const { user: user2 } = await makeUser(orm());
await request(app)
.post('/api/addons/atlas/region/DE-NW/mark')
@@ -473,7 +476,7 @@ describe('Mark/unmark region', () => {
describe('Regions geo', () => {
it('ATLAS-012 — GET /regions/geo without countries param returns empty FeatureCollection', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app).get('/api/addons/atlas/regions/geo').set('Cookie', authCookie(user.id));
@@ -482,7 +485,7 @@ describe('Regions geo', () => {
});
it('ATLAS-013 — GET /regions/geo?countries=DE,FR returns FeatureCollection', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app)
.get('/api/addons/atlas/regions/geo?countries=DE,FR')
@@ -496,7 +499,7 @@ describe('Regions geo', () => {
});
it('ATLAS-016 — GET /regions/geo/:code serves that country gzipped, cached for a day', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app)
.get('/api/addons/atlas/regions/geo/no')
@@ -514,7 +517,7 @@ describe('Regions geo', () => {
});
it('ATLAS-017 — GET /regions/geo/:code answers a country without regions with an empty FeatureCollection', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const res = await request(app).get('/api/addons/atlas/regions/geo/ZZ').set('Cookie', authCookie(user.id));
@@ -523,7 +526,7 @@ describe('Regions geo', () => {
});
it('ATLAS-018 — GET /regions/geo/:code refuses a code that is not two letters with a 400', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm());
const codes = ['NOR', '..%2Fadmin0'];
const answers = await Promise.all(
@@ -560,8 +563,8 @@ describe('A place that moves takes its Atlas country with it (#2527)', () => {
}
it('ATLAS-015: correcting a place from France to Germany moves it on the Atlas', async () => {
- const { user } = createUser(testDb);
- const trip = createTrip(testDb, user.id, {
+ const { user } = await makeUser(orm());
+ const trip = await makeTrip(orm(), user.id, {
title: 'Wrongly imported',
start_date: '2025-05-01',
end_date: '2025-05-05',
@@ -597,8 +600,8 @@ describe('A place that moves takes its Atlas country with it (#2527)', () => {
});
it('ATLAS-015: an edit that leaves the location alone keeps the cached country', async () => {
- const { user } = createUser(testDb);
- const trip = createTrip(testDb, user.id, { title: 'Paris', start_date: '2025-05-01', end_date: '2025-05-05' });
+ const { user } = await makeUser(orm());
+ const trip = await makeTrip(orm(), user.id, { title: 'Paris', start_date: '2025-05-01', end_date: '2025-05-05' });
const place = await makePlace(orm(), trip.id, {
name: 'Louvre',
lat: 48.8606,
diff --git a/server/tests/integration/backup.test.ts b/server/tests/integration/backup.test.ts
index d0bfa6b38..c3087be7d 100644
--- a/server/tests/integration/backup.test.ts
+++ b/server/tests/integration/backup.test.ts
@@ -7,12 +7,13 @@
* but the service should handle gracefully.
*/
import { buildApp } from '../../src/bootstrap';
-import { db as testDb } from '../../src/db/database';
import * as backupService from '../../src/nest/backup/backup.impl';
import { DEFAULT_BACKUPS_ROOT } from '../../src/nest/storage/storage-paths';
import { authCookie } from '../helpers/auth';
-import { createAdmin, createUser } from '../helpers/factories';
-import { resetTestDb, resetRateLimits } from '../helpers/test-db';
+import { makeAdmin, makeUser } from '../helpers/factories/users';
+import { resetDatabase } from '../helpers/reset-database';
+import { resetRateLimits } from '../helpers/test-db';
+import { MikroORM } from '@mikro-orm/core';
import type { INestApplication } from '@nestjs/common';
import type { Application } from 'express';
@@ -22,11 +23,6 @@ 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());
-});
-
// Mock filesystem-dependent service functions to avoid real disk I/O in tests
vi.mock('../../src/nest/backup/backup.impl', async () => {
const actual = await vi.importActual<typeof import('../../src/nest/backup/backup.impl')>(
@@ -71,25 +67,26 @@ vi.mock('../../src/nest/backup/auto-backup.settings', async () => {
let nestApp: INestApplication;
let app: Application;
+let orm: MikroORM;
beforeAll(async () => {
nestApp = await buildApp();
app = nestApp.getHttpAdapter().getInstance();
+ orm = nestApp.get(MikroORM);
});
beforeEach(async () => {
- resetTestDb(testDb);
+ await resetDatabase(orm);
await resetRateLimits(nestApp);
});
afterAll(async () => {
await nestApp.close();
- testDb.close();
});
describe('Backup access control', () => {
it('non-admin cannot access backup routes', async () => {
- const { user } = createUser(testDb);
+ const { user } = await makeUser(orm);
const res = await request(app).get('/api/backup/list').set('Cookie', authCookie(user.id));
expect(res.status).toBe(403);
@@ -98,7 +95,7 @@ describe('Backup access control', () => {
describe('Backup list', () => {
it('BACKUP-001 — GET /backup/list returns backups array', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const res = await request(app).get('/api/backup/list').set('Cookie', authCookie(admin.id));
expect(res.status).toBe(200);
@@ -108,7 +105,7 @@ describe('Backup list', () => {
describe('Backup creation', () => {
it('BACKUP-001 — POST /backup/create creates a backup', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const res = await request(app).post('/api/backup/create').set('Cookie', authCookie(admin.id));
expect(res.status).toBe(200);
@@ -120,7 +117,7 @@ describe('Backup creation', () => {
describe('Auto-backup settings', () => {
it('BACKUP-008 — GET /backup/auto-settings returns current config', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const res = await request(app).get('/api/backup/auto-settings').set('Cookie', authCookie(admin.id));
expect(res.status).toBe(200);
@@ -129,7 +126,7 @@ describe('Auto-backup settings', () => {
});
it('BACKUP-008 — PUT /backup/auto-settings updates settings', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const res = await request(app)
.put('/api/backup/auto-settings')
@@ -144,7 +141,7 @@ describe('Auto-backup settings', () => {
describe('Backup security', () => {
it('BACKUP-007 — Download with path traversal filename is rejected', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const res = await request(app).get('/api/backup/download/../../etc/passwd').set('Cookie', authCookie(admin.id));
// Express normalises the URL before routing; path traversal gets resolved
@@ -153,7 +150,7 @@ describe('Backup security', () => {
});
it('BACKUP-007 — Delete with path traversal filename is rejected', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const res = await request(app).delete('/api/backup/../../../etc/passwd').set('Cookie', authCookie(admin.id));
// Express normalises the URL, stripping traversal → no route match → 404
@@ -183,7 +180,7 @@ describe('Backup download', () => {
});
it('BACKUP-INT-001 — GET /backup/download/:filename returns 200 with content-disposition', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
// (Re)write the fixture immediately before the request that serves it.
fs.mkdirSync(DEFAULT_BACKUPS_ROOT, { recursive: true });
fs.writeFileSync(downloadFixturePath, 'fake zip content');
@@ -199,7 +196,7 @@ describe('Backup download', () => {
});
it('BACKUP-INT-002 — GET /backup/download/:filename returns 400 for invalid filename', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
vi.mocked(backupService.backupFileExists).mockResolvedValue(false);
const res = await request(app)
@@ -211,7 +208,7 @@ describe('Backup download', () => {
});
it('BACKUP-INT-003 — GET /backup/download/:filename returns 404 when file not found', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
vi.mocked(backupService.backupFileExists).mockResolvedValue(false);
const res = await request(app)
@@ -229,7 +226,7 @@ describe('Backup download', () => {
describe('Backup restore', () => {
it('BACKUP-INT-004 — POST /backup/restore/:filename returns 200 on success', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const filename = 'backup-2026-04-06T12-00-00.zip';
vi.mocked(backupService.backupFileExists).mockResolvedValue(true);
@@ -243,7 +240,7 @@ describe('Backup restore', () => {
});
it('BACKUP-INT-005 — POST /backup/restore/:filename returns 404 when backup not found', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
vi.mocked(backupService.backupFileExists).mockResolvedValue(false);
@@ -256,7 +253,7 @@ describe('Backup restore', () => {
});
it('BACKUP-INT-006 — POST /backup/restore/:filename returns 400 for invalid filename', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const res = await request(app).post('/api/backup/restore/../../evil.zip').set('Cookie', authCookie(admin.id));
@@ -265,7 +262,7 @@ describe('Backup restore', () => {
});
it('BACKUP-INT-007 — POST /backup/restore/:filename returns 400 when the restore reports failure', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const filename = 'backup-2026-04-06T12-00-00.zip';
vi.mocked(backupService.backupFileExists).mockResolvedValue(true);
@@ -288,7 +285,7 @@ describe('Backup restore', () => {
describe('Backup delete', () => {
it('BACKUP-INT-008 — DELETE /backup/:filename returns 200 on success', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const filename = 'backup-2026-04-06T12-00-00.zip';
vi.mocked(backupService.backupFileExists).mockResolvedValue(true);
@@ -303,7 +300,7 @@ describe('Backup delete', () => {
});
it('BACKUP-INT-009 — DELETE /backup/:filename returns 404 when not found', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
vi.mocked(backupService.backupFileExists).mockResolvedValue(false);
@@ -316,7 +313,7 @@ describe('Backup delete', () => {
});
it('BACKUP-INT-010 — DELETE /backup/:filename returns 400 for invalid filename', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const res = await request(app).delete('/api/backup/not-a-backup.tar.gz').set('Cookie', authCookie(admin.id));
@@ -331,7 +328,7 @@ describe('Backup delete', () => {
describe('Backup rate limiter', () => {
it('BACKUP-INT-011 — POST /backup/create returns 429 after 3 requests', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
// Allow first 3 calls, then block
let callCount = 0;
@@ -359,7 +356,7 @@ describe('Backup rate limiter', () => {
describe('Backup upload-restore', () => {
it('BACKUP-INT-012 — POST /backup/upload-restore with zip file returns 200', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
vi.mocked(backupService.restoreFromZip).mockResolvedValue({ success: true });
@@ -377,7 +374,7 @@ describe('Backup upload-restore', () => {
});
it('BACKUP-INT-013 — POST /backup/upload-restore with no file returns 400', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
const res = await request(app).post('/api/backup/upload-restore').set('Cookie', authCookie(admin.id));
@@ -386,7 +383,7 @@ describe('Backup upload-restore', () => {
});
it('BACKUP-INT-014 — POST /backup/upload-restore returns 400 when restore fails', async () => {
- const { user: admin } = createAdmin(testDb);
+ const { user: admin } = await makeAdmin(orm);
vi.mocked(backupService.restoreFromZip).mockResolvedValue({
success: false,
diff --git a/server/tests/postgres/snapshot-suites-baseline.json b/server/tests/postgres/snapshot-suites-baseline.json
index 2b2876ca4..52540df03 100644
--- a/server/tests/postgres/snapshot-suites-baseline.json
+++ b/server/tests/postgres/snapshot-suites-baseline.json
@@ -1,8 +1,6 @@
[
"tests/integration/admin.test.ts",
- "tests/integration/atlas.test.ts",
"tests/integration/auth.test.ts",
- "tests/integration/backup.test.ts",
"tests/integration/collab.test.ts",
"tests/integration/files.test.ts",
"tests/integration/journey-place-order.test.ts",