mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 10:45:57 +08:00
chore(server): move server tests folder (#9614)
This commit is contained in:
39
packages/backend/server/src/__tests__/config.spec.ts
Normal file
39
packages/backend/server/src/__tests__/config.spec.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { TestingModule } from '@nestjs/testing';
|
||||
import test from 'ava';
|
||||
|
||||
import { Config, ConfigModule } from '../base/config';
|
||||
import { createTestingModule } from './utils';
|
||||
|
||||
let config: Config;
|
||||
let module: TestingModule;
|
||||
test.beforeEach(async () => {
|
||||
module = await createTestingModule({}, false);
|
||||
config = module.get(Config);
|
||||
});
|
||||
|
||||
test.afterEach.always(async () => {
|
||||
await module.close();
|
||||
});
|
||||
|
||||
test('should be able to get config', t => {
|
||||
t.true(typeof config.server.host === 'string');
|
||||
t.is(config.projectRoot, process.cwd());
|
||||
t.is(config.NODE_ENV, 'test');
|
||||
});
|
||||
|
||||
test('should be able to override config', async t => {
|
||||
const module = await createTestingModule({
|
||||
imports: [
|
||||
ConfigModule.forRoot({
|
||||
server: {
|
||||
host: 'testing',
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
const config = module.get(Config);
|
||||
|
||||
t.is(config.server.host, 'testing');
|
||||
|
||||
await module.close();
|
||||
});
|
||||
Reference in New Issue
Block a user