toBe('Volaille de qualite') ->and(IncoStringParser::toPhrase(' viande de porc '))->toBe('Viande de porc') ->and(IncoStringParser::toPhrase(''))->toBe(''); }); }); describe('beautifyName', function (): void { it('converts text to title case and trims punctuation', function (): void { expect(IncoStringParser::beautifyName('poulet rôti fermier.'))->toBe('Poulet Rôti Fermier') ->and(IncoStringParser::beautifyName(':NUGGETS DE POULET'))->toBe('Nuggets De Poulet') ->and(IncoStringParser::beautifyName(''))->toBe(''); }); }); describe('beautifyText', function (): void { it('returns null when input is null', function (): void { expect(IncoStringParser::beautifyText(null))->toBeNull(); }); it('properly formats sentences and preserves decimal floating point numbers', function (): void { $input = 'viande de poulet 51,5% et eau 20.5%. cuisson au four.'; $result = IncoStringParser::beautifyText($input); expect($result)->toContain('51.5%') ->and($result)->toContain('20.5%') ->and($result)->toContain('Viande de poulet') ->and($result)->toContain('Cuisson au four.'); }); }); });