Make Safari tests pass again.
This commit is contained in:
parent
7dec2bd445
commit
8e6fa855ce
2 changed files with 16 additions and 23 deletions
|
@ -73,4 +73,10 @@ export class Safari extends EventEmitter {
|
||||||
|
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------------ shutdown ---- */
|
||||||
|
|
||||||
|
shutdown(): void {
|
||||||
|
this.CMDR?.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,26 @@
|
||||||
import {expect, jest, it} from '@jest/globals';
|
import { expect, jest, it } from '@jest/globals';
|
||||||
|
import { CMDR } from '../src/models/CMDR';
|
||||||
import {Journal} from '../src/models/Journal';
|
import { Safari } from '../src/models/Safari';
|
||||||
import {Safari} from '../src/models/Safari';
|
|
||||||
|
|
||||||
describe('Safari', () => {
|
describe('Safari', () => {
|
||||||
describe('start()', () => {
|
describe('start()', () => {
|
||||||
it('should return itself', () => {
|
it('should return itself', () => {
|
||||||
const safari = Safari.start(false, true);
|
const safari = Safari.start(false);
|
||||||
expect(safari).toBeDefined();
|
expect(safari).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a new journal', () => {
|
it('should create a new CMDR', () => {
|
||||||
const safari = Safari.start(false, true);
|
const safari = Safari.start(false);
|
||||||
expect(safari.journal).toBeInstanceOf(Journal);
|
expect(safari.CMDR).toBeInstanceOf(CMDR);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('shutdown()', () => {
|
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 () => {
|
it('should shutdown journal', async () => {
|
||||||
const safari = Safari.start(false, true);
|
const safari = Safari.start(false);
|
||||||
const journalShutdown = jest.spyOn(safari.journal, 'shutdown');
|
const journalShutdown = jest.spyOn(safari.CMDR, 'shutdown');
|
||||||
safari.watchJournalDir();
|
safari.shutdown();
|
||||||
await safari.shutdown();
|
|
||||||
expect(journalShutdown).toHaveBeenCalled();
|
expect(journalShutdown).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should shutdown when #watcher is undefined', async () => {
|
|
||||||
const safari = Safari.start(false, true);
|
|
||||||
await expect(safari.shutdown()).resolves.not.toThrow();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue