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