"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const truncate_js_1 = require("./truncate.js");
(0, vitest_1.describe)('truncate json', () => {
    (0, vitest_1.test)('truncates if exceeds line limit', () => {
        const objToTruncate = {
            key1: 'value1',
            key2: 'value2',
            key3: 'value3',
            key4: 'value4',
            key5: 'value4',
            key6: 'value6',
            key7: 'value7',
            key8: 'value8',
            key9: 'value9'
        };
        // eslint-disable-next-line no-useless-escape
        const expected = `{\"key1\":\"value1\",\"key2\":\"value2\",\"key3\":<… TRUNCATED …>:\"value9\"}`;
        (0, vitest_1.expect)((0, truncate_js_1.truncatedJsonStringify)(objToTruncate, 50)).toBe(expected);
    });
    (0, vitest_1.test)('does not truncate if under line limit', () => {
        const objToTruncate = {
            key1: 'value1',
            key2: 'value2',
            key3: 'value3',
            key4: 'value4',
            key5: 'value4',
            key6: 'value6',
            key7: 'value7',
            key8: 'value8',
            key9: 'value9'
        };
        (0, vitest_1.expect)((0, truncate_js_1.truncatedJsonStringify)(objToTruncate, 200)).toBe(JSON.stringify(objToTruncate));
    });
    (0, vitest_1.test)('handles null and undefined', () => {
        (0, vitest_1.expect)((0, truncate_js_1.truncatedJsonStringify)(undefined, 200)).toBe(undefined);
        (0, vitest_1.expect)((0, truncate_js_1.truncatedJsonStringify)(null, 200)).toBe('null');
    });
});
(0, vitest_1.describe)('truncate string', () => {
    (0, vitest_1.test)('does not truncate if under limit', () => {
        (0, vitest_1.expect)((0, truncate_js_1.truncateString)('hello', 10)).toBe('hello');
    });
    (0, vitest_1.test)('truncates and appends omission when over limit', () => {
        (0, vitest_1.expect)((0, truncate_js_1.truncateString)('abcdefghij', 8)).toBe('abcde...');
    });
    (0, vitest_1.test)('supports custom omission', () => {
        (0, vitest_1.expect)((0, truncate_js_1.truncateString)('abcdefghij', 8, '..')).toBe('abcdef..');
    });
    (0, vitest_1.test)('handles very small maxLength values', () => {
        (0, vitest_1.expect)((0, truncate_js_1.truncateString)('abcdefghij', 2)).toBe('..');
        (0, vitest_1.expect)((0, truncate_js_1.truncateString)('abcdefghij', 0)).toBe('');
    });
});
//# sourceMappingURL=truncate.test.js.map