fix: schedules lookups test mock missing classroomRepo constructor arg

The SchedulesService constructor expects 5 repository arguments.
The test only provided 4, passing {} as never for classroomRepo.
Added classroomRepo mock with find() returning full selected columns.

Fixes: schedules.lookups.spec.ts — 'returns scoped classes and
minimal classrooms for schedule viewers'
This commit is contained in:
2026-07-12 23:01:00 +08:00
parent cc4f4dae4e
commit b5f4b8747c

View File

@@ -16,16 +16,19 @@ describe('SchedulesService permission-scoped lookups', () => {
getRawMany: jest.fn().mockResolvedValue([{ classroomId: 5, classroomName: '教室5', classroomBuilding: 'A' }]),
}),
};
const classroomRepo = {
find: jest.fn().mockResolvedValue([{ id: 5, name: '教室5', building: 'A', floor: '1', roomType: 'classroom' }]),
};
const service = new SchedulesService(
scheduleRepo as never,
classRepo as never,
classroomRepo as never,
{} as never,
{} as never,
);
await expect(service.getLookups([3])).resolves.toEqual({
classes: [{ id: 3, name: '三班', code: 'C3' }],
classrooms: [{ id: 5, name: '教室5', building: 'A' }],
classrooms: [{ id: 5, name: '教室5', building: 'A', floor: '1', roomType: 'classroom' }],
});
});
});