"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const json_1 = require("../../src/assertions/json");
describe('getAjv', () => {
    beforeAll(() => {
        process.env.NODE_ENV = 'test';
    });
    beforeEach(() => {
        delete process.env.PROMPTFOO_DISABLE_AJV_STRICT_MODE;
        (0, json_1.resetAjv)();
    });
    afterEach(() => {
        delete process.env.PROMPTFOO_DISABLE_AJV_STRICT_MODE;
    });
    it('should create an Ajv instance with default options', () => {
        const ajv = (0, json_1.getAjv)();
        expect(ajv).toBeDefined();
        expect(ajv.opts.strictSchema).toBe(true);
    });
    it('should disable strict mode when PROMPTFOO_DISABLE_AJV_STRICT_MODE is set', () => {
        process.env.PROMPTFOO_DISABLE_AJV_STRICT_MODE = 'true';
        const ajv = (0, json_1.getAjv)();
        expect(ajv.opts.strictSchema).toBe(false);
    });
    it('should add formats to the Ajv instance', () => {
        const ajv = (0, json_1.getAjv)();
        expect(ajv.formats).toBeDefined();
        expect(Object.keys(ajv.formats)).not.toHaveLength(0);
    });
    it('should reuse the same instance on subsequent calls', () => {
        const firstInstance = (0, json_1.getAjv)();
        const secondInstance = (0, json_1.getAjv)();
        expect(firstInstance).toBe(secondInstance);
    });
});
//# sourceMappingURL=json.test.js.map