test(ArcadiaEmployeeId): add unit tests for ArcadiaEmployeeId value object

This commit is contained in:
Jérémy Munsch 2026-08-13 11:57:52 +02:00
parent 0111ee2ac4
commit f8b5722a78
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4

View file

@ -33,15 +33,6 @@ describe('ArcadiaEmployeeId Value Object', function (): void {
->and((string) $employeeId)->toBe('01155902');
});
it('throws a DomainException when given an invalid matricule pattern', function (): void {
// GIVEN
$invalidMatricule = '12345';
// WHEN & THEN
expect(fn () => new ArcadiaEmployeeId($invalidMatricule))
->toThrow(\DomainException::class);
});
it('supports equality check with another ArcadiaEmployeeId instance', function (): void {
// GIVEN
$firstId = new ArcadiaEmployeeId('01155902');
@ -54,4 +45,24 @@ describe('ArcadiaEmployeeId Value Object', function (): void {
->and($firstId->equals($differentId))
->toBeFalse();
});
it('can be converted to a string representation', function (): void {
// GIVEN
$employeeId = new ArcadiaEmployeeId('01155902');
// WHEN
$stringRepresentation = (string) $employeeId;
// THEN
expect($stringRepresentation)->toBe('01155902');
});
it('throws a DomainException when given an invalid matricule pattern', function (): void {
// GIVEN
$invalidMatricule = '12345';
// WHEN & THEN
expect(fn () => new ArcadiaEmployeeId($invalidMatricule))
->toThrow(\DomainException::class);
});
});