mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 07:26:30 +00:00
fix(realtime): place writes over MCP and plugins send what REST sends
This commit is contained in:
@@ -126,6 +126,7 @@ function build(
|
||||
updateCollection: vi.fn(() => ({})),
|
||||
savePlace: vi.fn(() => ({})),
|
||||
copyToTrip: vi.fn(() => ({})),
|
||||
tripEvents: vi.fn(() => ({ emit: vi.fn(), emitAll: vi.fn() })),
|
||||
deletePlace: vi.fn(() => Promise.resolve(undefined)),
|
||||
...overrides.collections,
|
||||
} as never,
|
||||
@@ -451,6 +452,16 @@ describe('addon-gated domains validate their input', () => {
|
||||
expect(updateCollection).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('ADDONERR-010b2 a copy hands the service the target trip and no socket, so every open planner hears it', async () => {
|
||||
const sink = { emit: vi.fn(), emitAll: vi.fn() };
|
||||
const tripEvents = vi.fn(() => sink);
|
||||
const copyToTrip = vi.fn(() => ({ copied: 1, skipped: [] }));
|
||||
const host = build({ collections: { tripEvents, copyToTrip } });
|
||||
await host.dispatch(req('collections.copyToTrip', { input: { trip_id: 7, place_ids: [3] } }), 42);
|
||||
expect(tripEvents).toHaveBeenCalledWith(7, undefined);
|
||||
expect(copyToTrip).toHaveBeenCalledWith(42, { trip_id: 7, place_ids: [3] }, sink);
|
||||
});
|
||||
|
||||
it('ADDONERR-010c a journal entry update carries a non-object input through asPayload', async () => {
|
||||
const updateEntry = vi.fn(() => ({ id: 1 }));
|
||||
const host = build({ journey: { updateEntry } });
|
||||
|
||||
Reference in New Issue
Block a user