feat(api): add M5 coverage controls and frontend spec

This commit is contained in:
zouantchaw
2026-03-18 08:18:50 +01:00
parent 008dd7efb1
commit 32f6cd55c8
14 changed files with 894 additions and 8 deletions

View File

@@ -44,6 +44,13 @@ function createMobileHandlers() {
name: payload.name,
costCenterId: payload.costCenterId,
}),
createShiftManager: async (_actor, payload) => ({
businessMembershipId: 'membership-1',
membershipStatus: 'INVITED',
invitedEmail: payload.email,
fullName: `${payload.firstName} ${payload.lastName}`,
managerAssignmentId: payload.hubId ? 'hub-manager-1' : null,
}),
approveInvoice: async (_actor, payload) => ({
invoiceId: payload.invoiceId,
status: 'APPROVED',
@@ -167,6 +174,25 @@ test('POST /commands/client/hubs returns injected hub response', async () => {
assert.equal(res.body.name, 'Google North Hub');
});
test('POST /commands/client/shift-managers creates an invited manager profile', async () => {
const app = createApp({ mobileCommandHandlers: createMobileHandlers() });
const res = await request(app)
.post('/commands/client/shift-managers')
.set('Authorization', 'Bearer test-token')
.set('Idempotency-Key', 'shift-manager-create-1')
.send({
hubId: '11111111-1111-4111-8111-111111111111',
email: 'manager@example.com',
firstName: 'Shift',
lastName: 'Lead',
});
assert.equal(res.status, 200);
assert.equal(res.body.membershipStatus, 'INVITED');
assert.equal(res.body.invitedEmail, 'manager@example.com');
assert.equal(res.body.managerAssignmentId, 'hub-manager-1');
});
test('POST /commands/client/billing/invoices/:invoiceId/approve injects invoice id from params', async () => {
const app = createApp({ mobileCommandHandlers: createMobileHandlers() });
const res = await request(app)