Files
AFFiNE/apps/server/src/tests/config.spec.ts
2023-09-01 19:41:29 +00:00

34 lines
753 B
TypeScript

import { ok } from 'node:assert';
import { Test } from '@nestjs/testing';
import test from 'ava';
import { Config, ConfigModule } from '../config';
let config: Config;
test.beforeEach(async () => {
const module = await Test.createTestingModule({
imports: [ConfigModule.forRoot()],
}).compile();
config = module.get(Config);
});
test('should be able to get config', t => {
t.true(typeof config.host === 'string');
t.is(config.env, 'test');
});
test('should be able to override config', async t => {
const module = await Test.createTestingModule({
imports: [
ConfigModule.forRoot({
host: 'testing',
}),
],
}).compile();
const config = module.get(Config);
ok(config.host, 'testing');
t.pass();
});