mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 14:51:45 +00:00
* fix(server): set oxc:false in vitest so the SWC transform survives the Vite 8 bump * fix(server): switch coverage to the istanbul provider (v8 under-reports branches on Vite 8 + Vitest 4) * test(nest): cover controller/service branches to clear the 80% coverage gate
This commit is contained in:
@@ -53,6 +53,12 @@ describe('TripsService (wrapper delegation + bundle/copy/notify helpers)', () =>
|
||||
s.exportICS('9'); expect(tripSvc.exportICS).toHaveBeenCalledWith('9');
|
||||
});
|
||||
|
||||
it('canAccessTrip delegates to the db helper', () => {
|
||||
canAccessTrip.mockReturnValueOnce({ user_id: 7 });
|
||||
expect(svc().canAccessTrip('9', 7)).toEqual({ user_id: 7 });
|
||||
expect(canAccessTrip).toHaveBeenCalledWith('9', 7);
|
||||
});
|
||||
|
||||
it('can() delegates to checkPermission; broadcast forwards', () => {
|
||||
svc().can('trip_edit', 'user', 1, 1, false);
|
||||
expect(checkPermission).toHaveBeenCalledWith('trip_edit', 'user', 1, 1, false);
|
||||
@@ -70,6 +76,12 @@ describe('TripsService (wrapper delegation + bundle/copy/notify helpers)', () =>
|
||||
expect(result).toMatchObject({ trip: { user_id: 1 }, days: [1], places: [], members: [{ id: 1 }] });
|
||||
});
|
||||
|
||||
it('bundle tolerates a null member list', () => {
|
||||
tripSvc.listMembers.mockReturnValueOnce({ owner: { id: 1 }, members: null });
|
||||
const result = svc().bundle('9', { user_id: 1 });
|
||||
expect(result).toMatchObject({ members: [{ id: 1 }] });
|
||||
});
|
||||
|
||||
it('notifyInvite is fire-and-forget (no throw)', () => {
|
||||
expect(() => svc().notifyInvite('9', { id: 1, email: 'a@b.c' } as never, 2, 'T', 'b@x.y')).not.toThrow();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user