mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 21:33:19 +00:00
fix(mail-ingest): attach a booking's documents while the trip has Documents off
A booking's files belong to the booking, so the mail's documents now reach it whatever the Documents switch says; a mail filed without a booking still needs Documents.
This commit is contained in:
@@ -226,6 +226,24 @@ describe('a booking that passes every check', () => {
|
||||
expect(t.realtime.broadcastMock).toHaveBeenCalledWith(trip.id, 'reservation:created', expect.anything());
|
||||
});
|
||||
|
||||
it('keeps the documents on its booking while the trip has Documents off', async () => {
|
||||
const user = await person();
|
||||
const trip = await makeTrip(orm(), user.id, { title: 'Japan', start_date: '2030-03-01', end_date: '2030-03-10' });
|
||||
await setAddonEnabled(orm(), 'documents', false);
|
||||
try {
|
||||
await forward(user.id, eml('flight'));
|
||||
const booking = await findRow(orm(), Reservations, { trip: trip.id });
|
||||
expect(files.createFileFromBytes).toHaveBeenCalledWith(
|
||||
trip.id,
|
||||
expect.objectContaining({ originalname: 'mail.txt' }),
|
||||
user.id,
|
||||
expect.objectContaining({ reservation_id: booking?.id }),
|
||||
);
|
||||
} finally {
|
||||
await setAddonEnabled(orm(), 'documents', true);
|
||||
}
|
||||
});
|
||||
|
||||
it('is undone by its forwarder: the booking and its cost go, the same mail again waits in the inbox', async () => {
|
||||
const user = await person();
|
||||
const trip = await makeTrip(orm(), user.id, { start_date: '2030-03-01', end_date: '2030-03-10' });
|
||||
|
||||
Reference in New Issue
Block a user