<commit_before>import {ObjectUtil} from "../../../app/util/object-util";

/**
 * @author <NAME>
 */
export function main() {

    describe('ObjectUtil', () => {

        it('returns el', () => {
            expect(ObjectUtil.getElForPathIn({a:{ b: { c: 'a'}}}, 'a.b.c')).toEqual('a');
        });

        it('returns undefined', () => {
            expect(ObjectUtil.getElForPathIn({a:{ }}, 'a.b.c')).toEqual(undefined);
        });

        it('takeOrMake makes', () => {
            const obj = { };
            expect(ObjectUtil.takeOrMake(obj, 'a.b.c', [])).toEqual([]);
            expect(obj['a']['b']['c']).toEqual([]);
        });

        it('takeOrMake takes', () => {
            expect(ObjectUtil.takeOrMake({a:{ b: { c: 'a'}}}, 'a.b.c', [])).toEqual('a');
        });<commit_msg>add unit test for compare method of object util<commit_after>import {ObjectUtil} from '../../../app/util/object-util';

/**
 * @author <NAME>
 * @author <NAME>
 */
export function main() {

    describe('ObjectUtil', () => {

        it('returns el', () => {
            expect(ObjectUtil.getElForPathIn({a:{ b: { c: 'a'}}}, 'a.b.c')).toEqual('a');
        });

        it('returns undefined', () => {
            expect(ObjectUtil.getElForPathIn({a:{ }}, 'a.b.c')).toEqual(undefined);
        });

        it('takeOrMake makes', () => {
            const obj = { };
            expect(ObjectUtil.takeOrMake(obj, 'a.b.c', [])).toEqual([]);
            expect(obj['a']['b']['c']).toEqual([]);
        });

        it('takeOrMake takes', () => {
            expect(ObjectUtil.takeOrMake({a:{ b: { c: 'a'}}}, 'a.b.c', [])).toEqual('a');
        });

        it('compare', () => {
            expect(ObjectUtil.compare('field1', 'field1')).toBe(true);
            expect(ObjectUtil.compare({ field: 'value' }, { field: 'value' })).toBe(true);
            expect(ObjectUtil.compare(['value1', 'value2'], ['value1', 'value2'])).toBe(true);
            expect(ObjectUtil.compare(undefined, undefined)).toBe(true);

            expect(ObjectUtil.compare('field1', undefined)).toBe(false);
            expect(ObjectUtil.compare(undefined, 'field1')).toBe(false);
            expect(ObjectUtil.compare({ field: 'value' }, undefined)).toBe(false);
            expect(ObjectUtil.compare(undefined, { field: 'value' })).toBe(false);
            expect(ObjectUtil.compare(['value1', 'value2'], undefined)).toBe(false);
            expect(ObjectUtil.compare(undefined, ['value1', 'value2'])).toBe(false);

            expect(ObjectUtil.compare('field1', 'field2')).toBe(false);
            expect(ObjectUtil.compare({ field: 'value1' }, { field: 'value2' })).toBe(false);
            expect(ObjectUtil.compare({ field: 'value1' }, { field: 'value1', anotherField: 'value2' })).toBe(false);
            expect(ObjectUtil.compare(['value1', 'value2'], ['value3', 'value4'])).toBe(false);

            expect(ObjectUtil.compare('field1', { field: 'value' })).toBe(false);
            expect(ObjectUtil.compare('field1', ['value1', 'value2'])).toBe(false);
            expect(ObjectUtil.compare({ field: 'value' }, ['value1', 'value2'])).toBe(false);
        });
{'fraction_non_alphanumeric': 0.23214285714285715, 'fraction_numerical': 0.009247448979591837, 'mean_word_length': 2.743436754176611, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 17, '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': '4610585', 'n_tokens_mistral': 969, 'n_tokens_neox': 969, 'n_words': 149}