fix(ci): resolve Journey strict checks and test contexts

Give the upload DTO an object for file-only requests, make UI error keys discoverable, and run the digest fixtures with the same ORM context as scheduled jobs.
This commit is contained in:
Maurice
2026-11-30 17:41:53 +01:00
parent 0c08a6dcb9
commit 21391e483d
40 changed files with 47 additions and 72 deletions
+5 -4
View File
@@ -11,6 +11,7 @@ import { JourneyEntryComments } from '../../src/db/entities/JourneyEntryComments
import { JourneyShareSubscribers } from '../../src/db/entities/JourneyShareSubscribers.entity';
import { Journeys } from '../../src/db/entities/Journeys.entity';
import { Notifications } from '../../src/db/entities/Notifications.entity';
import { withRequestContext } from '../../src/nest/database/request-context';
import { JourneyDigestService } from '../../src/nest/journey/journey-digest.service';
import { MailerService } from '../../src/nest/notifications/mailer/mailer.service';
import { NotificationsService } from '../../src/nest/notifications/notifications.service';
@@ -408,6 +409,7 @@ describe('following a link by email', () => {
});
describe('the daily digest', () => {
const runDigest = () => withRequestContext(orm, () => app.get(JourneyDigestService, { strict: false }).run());
it('JSOCIAL-E2E-030: the people hear of new entries, followers get one mail, nothing is told twice', async () => {
const send = mailWorks();
const { owner, editor, viewer, journey } = await journeyWithPeople();
@@ -420,8 +422,7 @@ describe('the daily digest', () => {
const fresh = await makeJourneyEntry(orm, journey.id, editor.id, { title: 'Furnas', entry_date: '2026-11-29' });
await makeJourneyEntry(orm, journey.id, editor.id, { title: 'Still a draft', is_draft: 1 });
const digest = app.get(JourneyDigestService, { strict: false });
const result = await digest.run(new Date());
const result = await runDigest();
await notifications.settled();
expect(result.journeys).toBeGreaterThanOrEqual(1);
expect(result.mailed).toBe(1);
@@ -444,7 +445,7 @@ describe('the daily digest', () => {
expect((await findRow(orm, JourneyEntries, { id: fresh.id }))?.announced).toBe(1);
send.mockClear();
expect(await digest.run(new Date())).toMatchObject({ journeys: 0, mailed: 0 });
expect(await runDigest()).toMatchObject({ journeys: 0, mailed: 0 });
expect(send).not.toHaveBeenCalled();
});
@@ -459,7 +460,7 @@ describe('the daily digest', () => {
send.mockClear();
await makeJourneyEntry(orm, journey.id, owner.id, { title: 'Behind the password', location_name: 'Furnas' });
await app.get(JourneyDigestService, { strict: false }).run(new Date());
await runDigest();
await notifications.settled();
const mails = send.mock.calls.filter(([to]) => to === 'locked-out@example.com');
+2 -1
View File
@@ -112,7 +112,7 @@ const { jsvc } = vi.hoisted(() => ({
listEntries: vi.fn(),
linkPhotoToEntry: vi.fn(),
unlinkPhotoFromEntry: vi.fn(),
canAccessJourney: vi.fn().mockResolvedValue(journeyRow(9)),
canAccessJourney: vi.fn(),
addContributor: vi.fn(),
updateContributorRole: vi.fn(),
},
@@ -899,6 +899,7 @@ describe('Journey e2e (real auth guard + temp SQLite)', () => {
describe('contributor roles', () => {
beforeEach(() => {
jsvc.canAccessJourney.mockReset().mockResolvedValue(journeyRow(9));
jsvc.addContributor.mockReset().mockResolvedValue(true);
jsvc.updateContributorRole.mockReset().mockResolvedValue(true);
});