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 => { store = { setRepresentation: jest.fn(async(): Promise => undefined), }; aclManager = { getAcl: jest.fn(async(): Promise => undefined), }; httpServer = { listen: jest.fn(), }; setup = new Setup(httpServer, store, aclManager, new RuntimeConfig()); }); it('starts an HTTP server.', async(): Promise => { await setup.setup(); expect(httpServer.listen).toHaveBeenCalledWith(3000); }); it('invokes ACL initialization.', async(): Promise => { await setup.setup(); expect(aclManager.getAcl).toHaveBeenCalledWith({ path: 'http://localhost:3000/' }); expect(store.setRepresentation).toHaveBeenCalledTimes(1); }); });