fix(occupancies): assign room resources during transfers
This commit is contained in:
28
apps/server/src/occupancies/dto/occupancy.dto.spec.ts
Normal file
28
apps/server/src/occupancies/dto/occupancy.dto.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { validate } from 'class-validator';
|
||||
import { CheckInDto, TransferRoomDto } from './occupancy.dto';
|
||||
|
||||
describe('manual occupancy DTO bed requirements', () => {
|
||||
it('requires a bed for manual check-in', async () => {
|
||||
const dto = Object.assign(new CheckInDto(), {
|
||||
studentId: 1,
|
||||
roomId: 2,
|
||||
checkInDate: '2026-07-13',
|
||||
});
|
||||
|
||||
const errors = await validate(dto);
|
||||
|
||||
expect(errors.some((error) => error.property === 'bedId')).toBe(true);
|
||||
});
|
||||
|
||||
it('requires a new bed for a room transfer while keeping the locker optional', async () => {
|
||||
const dto = Object.assign(new TransferRoomDto(), {
|
||||
newRoomId: 3,
|
||||
transferDate: '2026-07-13',
|
||||
});
|
||||
|
||||
const errors = await validate(dto);
|
||||
|
||||
expect(errors.some((error) => error.property === 'newBedId')).toBe(true);
|
||||
expect(errors.some((error) => error.property === 'newLockerId')).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user