<commit_before>import React from 'react';
import { render } from '@testing-library/react';

import Mark from './Mark';

describe('Mark component', () => {
    const input = `Eh, toi, l'ours mal léché`;
    let container: HTMLElement;
    let nodes: NodeListOf<HTMLElement>;

    beforeEach(() => {
        const result = render(<Mark value="e">{input}</Mark>);
        container = result.container;
        nodes = container.querySelectorAll('mark');
    });

    it('should highlight several matches', () => {
        expect(nodes?.length).toBe(3);
    });

    it('should highlight accent and capitalized matches', () => {
        const [first, second, third] = nodes;
        expect(first?.textContent).toBe('E');
        expect(second?.textContent).toBe('é');
        expect(third?.textContent).toBe('é');
    });

    it('should highlight print result properly', () => {
        expect(container?.innerHTML).toBe(`<mark>E</mark>h, toi, l'ours mal l<mark>é</mark>ch<mark>é</mark>`);
    });

    it('should return original children if no match', () => {
        const { container } = render(<Mark value="orage">{input}</Mark>);
        expect(container?.innerHTML).toBe(input);
    });

    it('should return original children if value empty', () => {
        const { container } = render(<Mark value="">{input}</Mark>);
        expect(container?.innerHTML).toBe(input);
    });

    it('should return original children if children not a string', () => {
        const { container } = render(
            <Mark value="orage">
                <input />
            </Mark>
        );
        expect(container?.innerHTML).toBe('<input>');
    });
});<commit_msg>Fix mark tests<commit_after>import React from 'react';
import { render } from '@testing-library/react';

import Mark from './Mark';

describe('Mark component', () => {
    const input = `Eh, toi, l'ours mal léché`;
    let container: HTMLElement;
    let nodes: NodeListOf<HTMLElement>;

    beforeEach(() => {
        const result = render(<Mark value="e">{input}</Mark>);
        container = result.container;
        nodes = container.querySelectorAll('mark');
    });

    it('should highlight several matches', () => {
        expect(nodes.length).toBe(3);
    });

    it('should highlight accent and capitalized matches', () => {
        expect(nodes[0].textContent).toBe('E');
        expect(nodes[1].textContent).toBe('é');
        expect(nodes[2].textContent).toBe('é');
    });

    it('should highlight print result properly', () => {
        expect(container.innerHTML).toBe(`<mark>E</mark>h, toi, l'ours mal l<mark>é</mark>ch<mark>é</mark>`);
    });

    it('should return original children if no match', () => {
        const { container } = render(<Mark value="orage">{input}</Mark>);
        expect(container.innerHTML).toBe(input);
    });

    it('should return original children if value empty', () => {
        const { container } = render(<Mark value="">{input}</Mark>);
        expect(container.innerHTML).toBe(input);
    });

    it('should return original children if children not a string', () => {
        const { container } = render(
            <Mark value="orage">
                <input />
            </Mark>
        );
        expect(container.innerHTML).toBe('<input>');
    });
});
{'fraction_non_alphanumeric': 0.1791044776119403, 'fraction_numerical': 0.0015229972586049345, 'mean_word_length': 2.8772136953955134, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3219717', 'n_tokens_mistral': 930, 'n_tokens_neox': 907, 'n_words': 209}