mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
Put the coverage back where the code went
Every split on this branch dropped the giving domain's ratchet without a line being tested any worse: coverage follows the source file, so when well-covered code leaves, the weaker branches that stay behind become the whole denominator. days fell from 82 to 77.5 percent branches that way, feeds to 76.7, trip-read-model to 62.5. The rule in vitest.config.ts is that the only way past a number is to raise it, so these are tests, not edits to the thresholds. days is back at 92.1, calendar at 96.2, trip-read-model at 100. feeds and trip-members and trip-read-model had no unit test at all - feeds' whole threshold rested on one e2e, which is exactly the file whose contract this branch rewrote. They have one now, and the read-model test pins the thing in that file that would leak data if it regressed: getTripSummary and bundle both thread the viewer id into packing.listItems so another member's private items stay hidden, and nothing asserted that before. The five thresholds this branch introduced move up to what they now measure, with a few points of slack. The pre-existing entries are left alone on purpose: they were generated from a Linux run, CI measures there, and a handful of branches are platform-specific - raising them from a Windows measurement is how you get a failure that reproduces nowhere local.
This commit is contained in:
@@ -108,6 +108,27 @@ describe('Tool: create_day', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('reports every bad reference in one message rather than the first', async () => {
|
||||
// The validator returns a list and the tool joins it. Without a case that
|
||||
// produces more than zero errors, that join is never executed, and a tool
|
||||
// that silently created a stay against a foreign place would look fine.
|
||||
const { user } = createUser(testDb);
|
||||
const trip = createTrip(testDb, user.id);
|
||||
const day = createDay(testDb, trip.id, { date: '2025-06-15' });
|
||||
await withHarness(user.id, async (h) => {
|
||||
const result = await h.client.callTool({
|
||||
name: 'create_accommodation',
|
||||
arguments: { tripId: trip.id, place_id: 999999, start_day_id: 999998, end_day_id: day.id },
|
||||
});
|
||||
expect(result.isError).toBe(true);
|
||||
const text = (result.content as { text: string }[])[0].text;
|
||||
expect(text).toContain('Place not found');
|
||||
expect(text).toContain('Start day not found');
|
||||
expect(text).toContain(', ');
|
||||
});
|
||||
expect(testDb.prepare('SELECT COUNT(*) AS n FROM day_accommodations').get()).toEqual({ n: 0 });
|
||||
});
|
||||
|
||||
it('returns access denied for non-member', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
const { user: other } = createUser(testDb);
|
||||
|
||||
Reference in New Issue
Block a user