mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 21:33:19 +00:00
fix(files): serve a plugin the files a trip keeps while Documents is off
The plugin file surface follows the REST rule: the list and reads keep booking, place, expense, note and message files, a write on a loose file goes through when it attaches it, and uploads and deletes stay open.
This commit is contained in:
@@ -90,6 +90,8 @@ function guardsFor() {
|
||||
}
|
||||
|
||||
const realtime = () => ({ broadcast: vi.fn() }) as never;
|
||||
/** Documents on for the trip, so the file writes below reach their service call. */
|
||||
const documentsOn = { isEnabledForTrip: vi.fn(async () => true) } as never;
|
||||
|
||||
describe('optional fields fall back rather than reaching the service as undefined', () => {
|
||||
it('FALLBACK-001 a tag update without name or colour forwards undefined for both', async () => {
|
||||
@@ -138,7 +140,7 @@ describe('optional fields fall back rather than reaching the service as undefine
|
||||
'p',
|
||||
ALL,
|
||||
makeDeps(),
|
||||
createTestPluginRegistry([new FilesRpc(files, realtime(), {} as never, guards, {} as never)]),
|
||||
createTestPluginRegistry([new FilesRpc(files, realtime(), {} as never, guards, {} as never, documentsOn)]),
|
||||
);
|
||||
await host.dispatch(req('files.createLink', { tripId: 1, fileId: 2, opts: {} }), 42);
|
||||
expect(createFileLink).toHaveBeenCalledWith(2, { reservation_id: null, assignment_id: null, place_id: null });
|
||||
@@ -152,7 +154,7 @@ describe('optional fields fall back rather than reaching the service as undefine
|
||||
'p',
|
||||
ALL,
|
||||
makeDeps(),
|
||||
createTestPluginRegistry([new FilesRpc(files, realtime(), {} as never, guards, {} as never)]),
|
||||
createTestPluginRegistry([new FilesRpc(files, realtime(), {} as never, guards, {} as never, documentsOn)]),
|
||||
);
|
||||
await host.dispatch(
|
||||
req('files.update', { tripId: 1, fileId: 2, input: { reservation_id: null, place_id: 7 } }),
|
||||
|
||||
Reference in New Issue
Block a user