feat(#171): API couples-garde AM (liste + courant)
Symétrique #168 : GET/PUT /assistantes-maternelles/me/couples-garde avec parents[] pour le bandeau enfant|foyer. Colonne id_placement_garde_courant sur assistantes_maternelles. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+29
-1
@@ -10,7 +10,10 @@ describe('AssistantesMaternellesController', () => {
|
||||
const authServiceMock = {
|
||||
createAmDossierStaff: jest.fn(),
|
||||
};
|
||||
const amServiceMock = {};
|
||||
const amServiceMock = {
|
||||
listerCouplesGarde: jest.fn(),
|
||||
definirCoupleGardeCourant: jest.fn(),
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
@@ -66,4 +69,29 @@ describe('AssistantesMaternellesController', () => {
|
||||
);
|
||||
expect(res.numero_dossier).toBe('2026-000001');
|
||||
});
|
||||
|
||||
it('listerCouplesGarde délègue au service (#171)', async () => {
|
||||
amServiceMock.listerCouplesGarde.mockResolvedValue({
|
||||
couples: [],
|
||||
couple_courant_id: null,
|
||||
});
|
||||
const res = await controller.listerCouplesGarde('am-uuid');
|
||||
expect(amServiceMock.listerCouplesGarde).toHaveBeenCalledWith('am-uuid');
|
||||
expect(res.couple_courant_id).toBeNull();
|
||||
});
|
||||
|
||||
it('definirCoupleGardeCourant délègue au service (#171)', async () => {
|
||||
amServiceMock.definirCoupleGardeCourant.mockResolvedValue({
|
||||
couples: [{ id: 'pl-1', courant: true }],
|
||||
couple_courant_id: 'pl-1',
|
||||
});
|
||||
const res = await controller.definirCoupleGardeCourant('am-uuid', {
|
||||
couple_id: 'pl-1',
|
||||
});
|
||||
expect(amServiceMock.definirCoupleGardeCourant).toHaveBeenCalledWith(
|
||||
'am-uuid',
|
||||
'pl-1',
|
||||
);
|
||||
expect(res.couple_courant_id).toBe('pl-1');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user