mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
32 lines
955 B
TypeScript
32 lines
955 B
TypeScript
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);
|
|
});
|
|
|
|
it('starts an HTTP server.', async(): Promise<void> => {
|
|
await setup.setup(3000, 'http://localhost:3000/');
|
|
expect(httpServer.listen).toHaveBeenCalledWith(3000);
|
|
});
|
|
|
|
it('invokes ACL initialization.', async(): Promise<void> => {
|
|
await setup.setup(3000, 'http://localhost:3000/');
|
|
expect(aclManager.getAcl).toHaveBeenCalledWith({ path: 'http://localhost:3000/' });
|
|
expect(store.setRepresentation).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|