feat(#131): fiches parent/AM éditable, placement AM↔enfant, statuts garde/sans_garde
Squash merge develop → master. - Fiche parent éditable (co-parent, PATCH fiche, GET /parents) - Fiche AM 3 onglets (PATCH fiche, rattacher/détacher enfants) - Table enfants_assistantes_maternelles + enum garde/sans_garde - Migration SQL + BDD.sql canonique - Correctifs recette : @Get() parents, DTO fiche AM, fix NIR Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { sanitizeUserForApi } from './sanitize-user-for-api';
|
||||
import { RoleType, StatutUtilisateurType, Users } from '../../entities/users.entity';
|
||||
|
||||
describe('sanitizeUserForApi', () => {
|
||||
const base: Users = {
|
||||
id: 'u1',
|
||||
email: 'a@b.fr',
|
||||
prenom: 'Paul',
|
||||
nom: 'Parent',
|
||||
role: RoleType.PARENT,
|
||||
statut: StatutUtilisateurType.ACTIF,
|
||||
password: 'hash',
|
||||
token_creation_mdp: 'tok',
|
||||
token_creation_mdp_expire_le: new Date(),
|
||||
password_reset_token: 'rst',
|
||||
password_reset_expires: new Date(),
|
||||
} as Users;
|
||||
|
||||
it('retire password et tokens', () => {
|
||||
const out = sanitizeUserForApi(base)!;
|
||||
expect(out.prenom).toBe('Paul');
|
||||
expect(out.nom).toBe('Parent');
|
||||
expect(out.password).toBeUndefined();
|
||||
expect(out.token_creation_mdp).toBeUndefined();
|
||||
expect(out.password_reset_token).toBeUndefined();
|
||||
});
|
||||
|
||||
it('retourne undefined si user absent', () => {
|
||||
expect(sanitizeUserForApi(null)).toBeUndefined();
|
||||
expect(sanitizeUserForApi(undefined)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user