refactor: Split off ServerInitializer.

This commit is contained in:
Ruben Verborgh
2020-12-07 22:33:37 +01:00
committed by Joachim Van Herwegen
parent b0ecf1c1d8
commit 04a91858c2
8 changed files with 55 additions and 48 deletions

View File

@@ -0,0 +1,18 @@
import { ServerInitializer } from '../../../src/init/ServerInitializer';
import type { HttpServerFactory } from '../../../src/server/HttpServerFactory';
describe('ServerInitializer', (): void => {
const serverFactory: jest.Mocked<HttpServerFactory> = {
startServer: jest.fn(),
};
let initializer: ServerInitializer;
beforeAll(async(): Promise<void> => {
initializer = new ServerInitializer(serverFactory, 3000);
});
it('starts an HTTP server.', async(): Promise<void> => {
await initializer.handle();
expect(serverFactory.startServer).toHaveBeenCalledWith(3000);
});
});