mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Add App class to start and stop the server
This commit is contained in:
25
test/unit/init/App.test.ts
Normal file
25
test/unit/init/App.test.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { App } from '../../../src/init/App';
|
||||
import type { Finalizable } from '../../../src/init/final/Finalizable';
|
||||
import type { Initializer } from '../../../src/init/Initializer';
|
||||
|
||||
describe('An App', (): void => {
|
||||
let initializer: Initializer;
|
||||
let finalizer: Finalizable;
|
||||
let app: App;
|
||||
|
||||
beforeEach(async(): Promise<void> => {
|
||||
initializer = { handleSafe: jest.fn() } as any;
|
||||
finalizer = { finalize: jest.fn() };
|
||||
app = new App(initializer, finalizer);
|
||||
});
|
||||
|
||||
it('can start with the initializer.', async(): Promise<void> => {
|
||||
await expect(app.start()).resolves.toBeUndefined();
|
||||
expect(initializer.handleSafe).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('can stop with the finalizer.', async(): Promise<void> => {
|
||||
await expect(app.stop()).resolves.toBeUndefined();
|
||||
expect(finalizer.finalize).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user