<commit_before>import { countAllNodesRecursively } from '../../lib/helpers/dom';

describe('countAllNodesRecursively', () => {
    it('should count node', () => {
        expect(countAllNodesRecursively(document.createElement('div'))).toBe(1);
    });
});<commit_msg>Add dom tests<commit_after>import { countAllNodesRecursively, getMaxDepth } from '../../lib/helpers/dom';

describe('countAllNodesRecursively', () => {
    it('should count node', () => {
        expect(countAllNodesRecursively(document.createElement('div'))).toBe(1);
    });

    it('should count node with children', () => {
        expect(countAllNodesRecursively(document.createElement('div').appendChild(document.createElement('div')))).toBe(
            2
        );
    });

    it('should count node with children and grandchildren', () => {
        expect(
            countAllNodesRecursively(
                document
                    .createElement('div')
                    .appendChild(document.createElement('div').appendChild(document.createElement('div')))
            )
        ).toBe(3);
    });
});

describe('getMaxDepth', () => {
    it('should get max depth', () => {
        expect(getMaxDepth(document.createElement('div'))).toBe(1);
    });

    it('should get max depth with children', () => {
        expect(getMaxDepth(document.createElement('div').appendChild(document.createElement('div')))).toBe(2);
    });

    it('should get max depth with children and grandchildren', () => {
        expect(
            getMaxDepth(
                document
                    .createElement('div')
                    .appendChild(document.createElement('div').appendChild(document.createElement('div')))
            )
        ).toBe(3);
    });
});
{'fraction_non_alphanumeric': 0.16752725186460127, 'fraction_numerical': 0.004016064257028112, 'mean_word_length': 2.70276008492569, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '4998743', 'n_tokens_mistral': 459, 'n_tokens_neox': 445, 'n_words': 68}