-
Notifications
You must be signed in to change notification settings - Fork 121
/
RuntimeConfig.test.ts
43 lines (36 loc) · 1.55 KB
/
RuntimeConfig.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { RuntimeConfig } from '../../../src/init/RuntimeConfig';
describe('RuntimeConfig', (): void => {
it('handles undefined args.', async(): Promise<void> => {
const config = new RuntimeConfig();
expect(config.port).toEqual(3000);
expect(config.base).toEqual('http://localhost:3000/');
});
it('handles empty args.', async(): Promise<void> => {
const config = new RuntimeConfig({});
expect(config.port).toEqual(3000);
expect(config.base).toEqual('http://localhost:3000/');
});
it('handles args with port.', async(): Promise<void> => {
const config = new RuntimeConfig({ port: 1234 });
expect(config.port).toEqual(1234);
expect(config.base).toEqual('http://localhost:1234/');
});
it('handles args with base.', async(): Promise<void> => {
const config = new RuntimeConfig({ base: 'http://example.org/' });
expect(config.port).toEqual(3000);
expect(config.base).toEqual('http://example.org/');
});
it('handles args with port and base.', async(): Promise<void> => {
const config = new RuntimeConfig({ port: 1234, base: 'http://example.org/' });
expect(config.port).toEqual(1234);
expect(config.base).toEqual('http://example.org/');
});
it('handles resetting data.', async(): Promise<void> => {
const config = new RuntimeConfig({});
expect(config.port).toEqual(3000);
expect(config.base).toEqual('http://localhost:3000/');
config.reset({ port: 1234, base: 'http://example.org/' });
expect(config.port).toEqual(1234);
expect(config.base).toEqual('http://example.org/');
});
});