"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const resolveQueryTimezone_1 = require("./resolveQueryTimezone");
describe('resolveQueryTimezone', () => {
    it('returns metricQuery.timezone when set', () => {
        expect((0, resolveQueryTimezone_1.resolveQueryTimezone)({ timezone: 'America/New_York' }, 'Australia/Brisbane')).toBe('America/New_York');
    });
    it('falls back to project timezone when metricQuery.timezone is undefined', () => {
        expect((0, resolveQueryTimezone_1.resolveQueryTimezone)({ timezone: undefined }, 'Australia/Brisbane')).toBe('Australia/Brisbane');
    });
    it('falls back to project timezone when timezone field is missing', () => {
        expect((0, resolveQueryTimezone_1.resolveQueryTimezone)({}, 'Europe/London')).toBe('Europe/London');
    });
    it('accepts UTC', () => {
        expect((0, resolveQueryTimezone_1.resolveQueryTimezone)({}, 'UTC')).toBe('UTC');
    });
    it('throws on invalid metricQuery timezone', () => {
        expect(() => (0, resolveQueryTimezone_1.resolveQueryTimezone)({ timezone: "'; DROP TABLE users; --" }, 'UTC')).toThrow('Invalid timezone');
    });
    it('throws on invalid project timezone', () => {
        expect(() => (0, resolveQueryTimezone_1.resolveQueryTimezone)({}, 'Not/A/Timezone')).toThrow('Invalid timezone');
    });
    it('throws on timezone with SQL injection attempt', () => {
        expect(() => (0, resolveQueryTimezone_1.resolveQueryTimezone)({ timezone: "UTC' OR '1'='1" }, 'UTC')).toThrow('Invalid timezone');
    });
});
//# sourceMappingURL=resolveQueryTimezone.test.js.map