test(plugins): cover the mock double and the child proxy for addEntryPhoto

The handler had eight cases, its two doubles had none, which Sonar counted as
new code without coverage. The mock is the more useful of the two to pin
anyway: an importer developing against it should hit the same refusals it will
hit in production, so the SVG, the missing extension, the empty payload and the
size cap are all asserted against the double rather than only against the host.
This commit is contained in:
Maurice
2026-08-28 17:39:38 +02:00
committed by Maurice
parent 661777f81f
commit 6c7e257c17
2 changed files with 35 additions and 0 deletions
@@ -29,6 +29,9 @@ describe('createPluginContext', () => {
await ctx.trips.getById(1);
expect(rpc).toHaveBeenCalledWith('trips.getById', { tripId: 1, _inv: 'inv-1' });
await ctx.journal.addEntryPhoto(5, { name: 'a.jpg', content_base64: 'eA==' });
expect(rpc).toHaveBeenCalledWith('journal.addEntryPhoto', { entryId: 5, input: { name: 'a.jpg', content_base64: 'eA==' }, _inv: 'inv-1' });
await ctx.ws.broadcastToTrip(1, 'ping', { a: 1 });
// carries _inv so the host can bind the acting user — without it the broadcast was refused
expect(rpc).toHaveBeenCalledWith('ws.broadcastToTrip', { tripId: 1, event: 'ping', data: { a: 1 }, _inv: 'inv-1' });