0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 09:16:49 +01:00
posthog/plugin-server/tests/config.test.ts
James Greenhill 434e379f9a Add 'plugin-server/' from commit '01a99a4e26b0b11f068a7073d6b94e53a7214d33'
git-subtree-dir: plugin-server
git-subtree-mainline: 776b056b6d
git-subtree-split: 01a99a4e26
2021-10-28 14:59:19 -07:00

30 lines
901 B
TypeScript

import { getDefaultConfig, overrideWithEnv } from '../src/config/config'
test('overrideWithEnv 1', () => {
const defaultConfig = getDefaultConfig()
const env = {
KAFKA_ENABLED: 'false',
TASK_TIMEOUT: '3008',
CLICKHOUSE_HOST: '0.0.0.0',
BASE_DIR: undefined,
}
const config = overrideWithEnv(getDefaultConfig(), env)
expect(config.KAFKA_ENABLED).toEqual(false)
expect(config.TASK_TIMEOUT).toEqual(3008)
expect(config.CLICKHOUSE_HOST).toEqual('0.0.0.0')
expect(config.BASE_DIR).toEqual(defaultConfig.BASE_DIR)
})
test('overrideWithEnv 2', () => {
const defaultConfig = getDefaultConfig()
const env = {
KAFKA_ENABLED: '1',
TASK_TIMEOUT: '3008.12',
}
const config = overrideWithEnv(getDefaultConfig(), env)
expect(config.KAFKA_ENABLED).toEqual(true)
expect(config.TASK_TIMEOUT).toEqual(3008.12)
})