mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
Merge branch 'main' into versions/6.0.0
# Conflicts: # src/init/ServerInitializer.ts # src/server/BaseHttpServerFactory.ts # src/server/HttpServerFactory.ts # src/server/WebSocketServerFactory.ts # test/unit/server/BaseHttpServerFactory.test.ts
This commit is contained in:
@@ -20,6 +20,7 @@ describe('ServerInitializer', (): void => {
|
||||
(getLoggerFor as jest.MockedFn<() => Logger>).mockReturnValue(logger);
|
||||
|
||||
server = {
|
||||
address: jest.fn().mockResolvedValue('address'),
|
||||
listen: jest.fn(),
|
||||
close: jest.fn((fn: () => void): void => fn()),
|
||||
} as any;
|
||||
@@ -49,6 +50,18 @@ describe('ServerInitializer', (): void => {
|
||||
expect(logger.info).toHaveBeenLastCalledWith(`Listening to server at https://localhost:3000/`);
|
||||
});
|
||||
|
||||
it('listens to the specified Unix Domain Socket.', async(): Promise<void> => {
|
||||
initializer = new ServerInitializer(serverFactory, undefined, '/tmp/css.sock');
|
||||
await initializer.handle();
|
||||
expect(server.listen).toHaveBeenCalledWith('/tmp/css.sock');
|
||||
});
|
||||
|
||||
it('throws when neither port or socket are set.', async(): Promise<void> => {
|
||||
expect((): void => {
|
||||
initializer = new ServerInitializer(serverFactory, undefined, undefined);
|
||||
}).toThrow('Either Port or Socket arguments must be set');
|
||||
});
|
||||
|
||||
it('can stop the server.', async(): Promise<void> => {
|
||||
await initializer.handle();
|
||||
await expect(initializer.finalize()).resolves.toBeUndefined();
|
||||
|
||||
Reference in New Issue
Block a user