fix(occupancies): assign room resources during transfers

This commit is contained in:
2026-07-13 12:01:48 +08:00
parent 8cadf8970e
commit 2874ab7bee
6 changed files with 156 additions and 13 deletions

View File

@@ -0,0 +1,27 @@
import { describe, expect, it } from 'vitest';
import dayjs from 'dayjs';
import { buildTransferPayload } from './occupancy-form';
describe('occupancy transfer form', () => {
it('submits the target room resources with the transfer dates', () => {
expect(
buildTransferPayload({
newRoomId: 5,
newBedId: 12,
newLockerId: 18,
transferDate: dayjs('2026-07-13'),
oldBillingEndDate: dayjs('2026-07-13'),
newBillingStartDate: dayjs('2026-07-14'),
reason: '调整宿舍',
}),
).toEqual({
newRoomId: 5,
newBedId: 12,
newLockerId: 18,
transferDate: '2026-07-13',
oldBillingEndDate: '2026-07-13',
newBillingStartDate: '2026-07-14',
reason: '调整宿舍',
});
});
});