fix(api): close v2 mobile contract gaps
This commit is contained in:
@@ -77,6 +77,12 @@ function createMobileHandlers() {
|
||||
assignmentId: payload.assignmentId || 'assignment-1',
|
||||
status: 'CLOCK_OUT',
|
||||
}),
|
||||
submitCompletedShiftForApproval: async (_actor, payload) => ({
|
||||
shiftId: payload.shiftId,
|
||||
timesheetId: 'timesheet-1',
|
||||
status: 'SUBMITTED',
|
||||
submitted: true,
|
||||
}),
|
||||
submitLocationStreamBatch: async (_actor, payload) => ({
|
||||
assignmentId: payload.assignmentId || 'assignment-1',
|
||||
pointCount: payload.points.length,
|
||||
@@ -342,3 +348,19 @@ test('POST /commands/staff/profile/bank-accounts uppercases account type', async
|
||||
assert.equal(res.body.accountType, 'CHECKING');
|
||||
assert.equal(res.body.last4, '7890');
|
||||
});
|
||||
|
||||
test('POST /commands/staff/shifts/:shiftId/submit-for-approval injects shift id from params', async () => {
|
||||
const app = createApp({ mobileCommandHandlers: createMobileHandlers() });
|
||||
const res = await request(app)
|
||||
.post('/commands/staff/shifts/77777777-7777-4777-8777-777777777777/submit-for-approval')
|
||||
.set('Authorization', 'Bearer test-token')
|
||||
.set('Idempotency-Key', 'shift-submit-approval-1')
|
||||
.send({
|
||||
note: 'Worked full shift and ready for approval',
|
||||
});
|
||||
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(res.body.shiftId, '77777777-7777-4777-8777-777777777777');
|
||||
assert.equal(res.body.timesheetId, 'timesheet-1');
|
||||
assert.equal(res.body.submitted, true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user