feat(#168): API couples de garde parent (liste + couple courant).
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -13,7 +13,10 @@ describe('ParentsController', () => {
|
||||
createParentDossierStaff: jest.fn(),
|
||||
addCoParentStaff: jest.fn(),
|
||||
};
|
||||
const parentsServiceMock = {};
|
||||
const parentsServiceMock = {
|
||||
listerCouplesGarde: jest.fn(),
|
||||
definirCoupleGardeCourant: jest.fn(),
|
||||
};
|
||||
const userServiceMock = {};
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -39,6 +42,31 @@ describe('ParentsController', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
|
||||
it('listerCouplesGarde délègue au service (#168)', async () => {
|
||||
parentsServiceMock.listerCouplesGarde.mockResolvedValue({
|
||||
couples: [],
|
||||
couple_courant_id: null,
|
||||
});
|
||||
const res = await controller.listerCouplesGarde('parent-uuid');
|
||||
expect(parentsServiceMock.listerCouplesGarde).toHaveBeenCalledWith('parent-uuid');
|
||||
expect(res.couples).toEqual([]);
|
||||
});
|
||||
|
||||
it('definirCoupleGardeCourant délègue au service (#168)', async () => {
|
||||
parentsServiceMock.definirCoupleGardeCourant.mockResolvedValue({
|
||||
couples: [{ id: 'pl-1', courant: true }],
|
||||
couple_courant_id: 'pl-1',
|
||||
});
|
||||
const res = await controller.definirCoupleGardeCourant('parent-uuid', {
|
||||
couple_id: 'pl-1',
|
||||
});
|
||||
expect(parentsServiceMock.definirCoupleGardeCourant).toHaveBeenCalledWith(
|
||||
'parent-uuid',
|
||||
'pl-1',
|
||||
);
|
||||
expect(res.couple_courant_id).toBe('pl-1');
|
||||
});
|
||||
|
||||
it('createDossier delegates to authService.createParentDossierStaff with CGU accepted', async () => {
|
||||
authServiceMock.createParentDossierStaff.mockResolvedValue({
|
||||
message: 'Dossier famille créé et validé. Un e-mail de création de mot de passe a été envoyé.',
|
||||
|
||||
Reference in New Issue
Block a user