"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const index_js_1 = require("../errors/index.js");
const index_js_2 = require("../types/index.js");
const environment_js_1 = require("./environment.js");
(0, vitest_1.describe)('default environment', () => {
    (0, vitest_1.test)('returns the correct metadata for environment', () => {
        (0, vitest_1.expect)((0, environment_js_1.getDefaultEnvironment)(true)).toBe(index_js_2.ENVIRONMENT_PRODUCTION);
        (0, vitest_1.expect)((0, environment_js_1.getDefaultDatasourceEnvironment)(true)).toBe(index_js_2.DatasourceEnvironments.PRODUCTION);
        (0, vitest_1.expect)((0, environment_js_1.getDefaultEnvironment)(false)).toBe(index_js_2.ENVIRONMENT_STAGING);
        (0, vitest_1.expect)((0, environment_js_1.getDefaultDatasourceEnvironment)(false)).toBe(index_js_2.DatasourceEnvironments.STAGING);
    });
});
(0, vitest_1.describe)('check environment', () => {
    (0, vitest_1.test)('errors when environment is missing', () => {
        (0, vitest_1.expect)(() => {
            (0, environment_js_1.checkEnvironment)('');
        }).toThrowError(index_js_1.BadRequestError);
    });
    (0, vitest_1.test)('errors when environment is not valid', () => {
        (0, vitest_1.expect)(() => {
            (0, environment_js_1.checkEnvironment)('foo');
        }).toThrowError(index_js_1.BadRequestError);
    });
    (0, vitest_1.test)('accepts valid environments', () => {
        (0, vitest_1.expect)((0, environment_js_1.checkEnvironment)(index_js_2.ENVIRONMENT_PRODUCTION)).toBe(index_js_2.ENVIRONMENT_PRODUCTION);
        (0, vitest_1.expect)((0, environment_js_1.checkEnvironment)(index_js_2.ENVIRONMENT_STAGING)).toBe(index_js_2.ENVIRONMENT_STAGING);
        (0, vitest_1.expect)((0, environment_js_1.checkEnvironment)(index_js_2.ENVIRONMENT_ALL)).toBe(index_js_2.ENVIRONMENT_ALL);
    });
});
//# sourceMappingURL=environment.test.js.map