check http server setup before start

This commit is contained in:
restrry 2019-04-25 13:01:38 +03:00
parent 255d3c3abc
commit 8880af1428
2 changed files with 7 additions and 1 deletions

View file

@ -607,3 +607,9 @@ test('registers onRequest interceptor several times', async () => {
doRegister();
expect(doRegister).not.toThrowError();
});
test('throws an error if starts without set up', async () => {
await expect(server.start(config)).rejects.toThrowErrorMatchingInlineSnapshot(
`"Http server is not setup up yet"`
);
});

View file

@ -92,7 +92,7 @@ export class HttpServer {
public async start(config: HttpConfig) {
if (this.server === undefined) {
throw new Error('server is not setup up yet');
throw new Error('Http server is not setup up yet');
}
this.log.debug('starting http server');