diff --git a/src/models/Safari.ts b/src/models/Safari.ts index fac6010..ca56e69 100644 --- a/src/models/Safari.ts +++ b/src/models/Safari.ts @@ -73,4 +73,10 @@ export class Safari extends EventEmitter { return dir; } + + /* ------------------------------------------------------------------------------ shutdown ---- */ + + shutdown(): void { + this.CMDR?.shutdown(); + } } diff --git a/test/Safari.test.ts b/test/Safari.test.ts index f40b5d0..839aa21 100644 --- a/test/Safari.test.ts +++ b/test/Safari.test.ts @@ -1,39 +1,26 @@ -import {expect, jest, it} from '@jest/globals'; - -import {Journal} from '../src/models/Journal'; -import {Safari} from '../src/models/Safari'; +import { expect, jest, it } from '@jest/globals'; +import { CMDR } from '../src/models/CMDR'; +import { Safari } from '../src/models/Safari'; describe('Safari', () => { describe('start()', () => { it('should return itself', () => { - const safari = Safari.start(false, true); + const safari = Safari.start(false); expect(safari).toBeDefined(); }); - it('should create a new journal', () => { - const safari = Safari.start(false, true); - expect(safari.journal).toBeInstanceOf(Journal); + it('should create a new CMDR', () => { + const safari = Safari.start(false); + expect(safari.CMDR).toBeInstanceOf(CMDR); }); }); describe('shutdown()', () => { - it('should shutdown', async () => { - const safari = Safari.start(false, true); - safari.watchJournalDir(); - await expect(safari.shutdown()).resolves.not.toThrow(); - }); - it('should shutdown journal', async () => { - const safari = Safari.start(false, true); - const journalShutdown = jest.spyOn(safari.journal, 'shutdown'); - safari.watchJournalDir(); - await safari.shutdown(); + const safari = Safari.start(false); + const journalShutdown = jest.spyOn(safari.CMDR, 'shutdown'); + safari.shutdown(); expect(journalShutdown).toHaveBeenCalled(); }); - - it('should shutdown when #watcher is undefined', async () => { - const safari = Safari.start(false, true); - await expect(safari.shutdown()).resolves.not.toThrow(); - }); }); });