-
Notifications
You must be signed in to change notification settings - Fork 121
/
Setup.test.ts
32 lines (29 loc) · 981 Bytes
/
Setup.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
import { RuntimeConfig } from '../../../src/init/RuntimeConfig';
import { Setup } from '../../../src/init/Setup';
describe('Setup', (): void => {
let httpServer: any;
let store: any;
let aclManager: any;
let setup: Setup;
beforeEach(async(): Promise<void> => {
store = {
setRepresentation: jest.fn(async(): Promise<void> => undefined),
};
aclManager = {
getAcl: jest.fn(async(): Promise<void> => undefined),
};
httpServer = {
listen: jest.fn(),
};
setup = new Setup(httpServer, store, aclManager, new RuntimeConfig());
});
it('starts an HTTP server.', async(): Promise<void> => {
await setup.setup();
expect(httpServer.listen).toHaveBeenCalledWith(3000);
});
it('invokes ACL initialization.', async(): Promise<void> => {
await setup.setup();
expect(aclManager.getAcl).toHaveBeenCalledWith({ path: 'http://localhost:3000/' });
expect(store.setRepresentation).toHaveBeenCalledTimes(1);
});
});