fix: 修复后端 CI 检查与测试
This commit is contained in:
@@ -362,7 +362,7 @@ describe('ClassroomRentalsService — rental schedule sync', () => {
|
||||
expect(scheduleRepo.delete).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('deletes the RENTAL schedule row when the rental is cancelled', async () => {
|
||||
it('deactivates the RENTAL schedule row when the rental is cancelled', async () => {
|
||||
const rental = {
|
||||
id: 1,
|
||||
classroomId: 1,
|
||||
@@ -379,7 +379,10 @@ describe('ClassroomRentalsService — rental schedule sync', () => {
|
||||
await service.cancel(1);
|
||||
|
||||
expect(rentalRepo.update).toHaveBeenCalledWith(1, { status: 'cancelled' });
|
||||
expect(scheduleRepo.delete).toHaveBeenCalledWith({ rentalId: 1, scheduleType: 'RENTAL' });
|
||||
expect(scheduleRepo.update).toHaveBeenCalledWith(
|
||||
{ rentalId: 1, scheduleType: 'RENTAL' },
|
||||
{ status: 'inactive' },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -419,14 +422,14 @@ describe('ClassroomRentalsService — rental schedule sync', () => {
|
||||
});
|
||||
|
||||
describe('remove()', () => {
|
||||
it('deletes the RENTAL schedule row and the rental', async () => {
|
||||
it('archives the rental and deactivates its RENTAL schedule row', async () => {
|
||||
const rental = {
|
||||
id: 1,
|
||||
classroomId: 1,
|
||||
lesseeOrganizationId: 2,
|
||||
startDate: '2026-03-01',
|
||||
endDate: '2026-03-31',
|
||||
status: 'cancelled',
|
||||
status: 'active',
|
||||
lesseeOrganization: { id: 2, name: 'Organization A' } as Organization,
|
||||
} as ClassroomRental;
|
||||
|
||||
@@ -434,8 +437,12 @@ describe('ClassroomRentalsService — rental schedule sync', () => {
|
||||
|
||||
await service.remove(1);
|
||||
|
||||
expect(scheduleRepo.delete).toHaveBeenCalledWith({ rentalId: 1, scheduleType: 'RENTAL' });
|
||||
expect(rentalRepo.delete).toHaveBeenCalledWith(1);
|
||||
expect(rentalRepo.update).toHaveBeenCalledWith(1, { status: 'cancelled' });
|
||||
expect(scheduleRepo.update).toHaveBeenCalledWith(
|
||||
{ rentalId: 1, scheduleType: 'RENTAL' },
|
||||
{ status: 'inactive' },
|
||||
);
|
||||
expect(rentalRepo.delete).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user