chore: set text in english not the best langage, french

This commit is contained in:
Corentin Bringer 2025-07-25 18:34:06 +02:00
commit 170bdfad8a

View file

@ -3,40 +3,40 @@ import { compareTextsHtml } from './service';
describe('compareTextsHtml', () => {
it('should highlight added text', () => {
const textA = 'Bonjour tout le monde';
const textB = 'Bonjour tout le monde ici';
const textA = 'Hello world';
const textB = 'Hello world here';
const result = compareTextsHtml(textA, textB);
expect(result).toContain('<span class="diff-added">&nbsp;ici</span>');
expect(result).toContain('<span class="diff-added">&nbsp;here</span>');
});
it('should highlight removed text', () => {
const textA = 'Bonjour tout le monde ici';
const textB = 'Bonjour tout le monde';
const textA = 'Hello world here';
const textB = 'Hello world';
const result = compareTextsHtml(textA, textB);
expect(result).toContain('<span class="diff-removed">&nbsp;ici</span>');
expect(result).toContain('<span class="diff-removed">&nbsp;here</span>');
});
it('should highlight changes in the middle of a sentence', () => {
const textA = 'Je suis à Lyon';
const textB = 'Je suis à Marseille';
const textA = 'I am in Lyon';
const textB = 'I am in Marseille';
const result = compareTextsHtml(textA, textB);
expect(result).toContain('Je&nbsp;suis&nbsp;à&nbsp;');
expect(result).toContain('I&nbsp;am&nbsp;in&nbsp;');
expect(result).toContain('<span class="diff-removed">Lyon</span>');
expect(result).toContain('<span class="diff-added">Marseille</span>');
});
it('should return empty diff if texts are identical', () => {
const input = 'Même texte partout';
it('should return plain diff if texts are identical', () => {
const input = 'Same text everywhere';
const result = compareTextsHtml(input, input);
expect(result).toContain('<span>Même&nbsp;texte&nbsp;partout</span>');
expect(result).toContain('<span>Same&nbsp;text&nbsp;everywhere</span>');
expect(result).not.toContain('diff-added');
expect(result).not.toContain('diff-removed');
});
it('should handle HTML escaping', () => {
it('should escape HTML characters', () => {
const textA = '<b>Hello</b>';
const textB = '<b>Hello world</b>';
@ -45,28 +45,24 @@ describe('compareTextsHtml', () => {
expect(result).toContain('<span class="diff-added">&nbsp;world</span>');
});
it('should return a single div with class diff-line', () => {
it('should wrap result in a single diff-line div', () => {
const result = compareTextsHtml('foo', 'bar');
expect(result.startsWith('<div class="diff-line">')).toBe(true);
expect(result.endsWith('</div>')).toBe(true);
});
it('should handle empty strings', () => {
it('should handle empty input strings', () => {
const result = compareTextsHtml('', '');
expect(result).toBe('<div class="diff-line"></div>');
});
it('should handle only added content', () => {
const result = compareTextsHtml('', 'Nouveau texte');
expect(result).toContain(
'<span class="diff-added">Nouveau&nbsp;texte</span>'
);
it('should handle only added input', () => {
const result = compareTextsHtml('', 'New text');
expect(result).toContain('<span class="diff-added">New&nbsp;text</span>');
});
it('should handle only removed content', () => {
const result = compareTextsHtml('Ancien texte', '');
expect(result).toContain(
'<span class="diff-removed">Ancien&nbsp;texte</span>'
);
it('should handle only removed input', () => {
const result = compareTextsHtml('Old text', '');
expect(result).toContain('<span class="diff-removed">Old&nbsp;text</span>');
});
});