ed-safari/test/Safari.test.ts

31 lines
828 B
TypeScript
Raw Normal View History

2023-05-18 09:59:17 -07:00
import { expect, jest, it } from '@jest/globals';
import { CMDR } from '../src/models/CMDR';
import { Safari } from '../src/models/Safari';
2023-05-15 13:39:30 -07:00
2023-05-16 20:15:37 -07:00
describe('Safari', () => {
describe('start()', () => {
2023-05-18 20:13:30 -07:00
afterEach(() => {
Safari.start().shutdown();
});
2023-05-16 20:15:37 -07:00
it('should return itself', () => {
2023-05-18 09:59:17 -07:00
const safari = Safari.start(false);
2023-05-16 20:15:37 -07:00
expect(safari).toBeDefined();
});
2023-05-18 09:59:17 -07:00
it('should create a new CMDR', () => {
const safari = Safari.start(false);
expect(safari.CMDR).toBeInstanceOf(CMDR);
2023-05-16 20:15:37 -07:00
});
});
describe('shutdown()', () => {
it('should shutdown journal', async () => {
2023-05-18 09:59:17 -07:00
const safari = Safari.start(false);
const journalShutdown = jest.spyOn(safari.CMDR, 'shutdown');
safari.shutdown();
2023-05-16 20:15:37 -07:00
expect(journalShutdown).toHaveBeenCalled();
});
2023-05-15 13:39:30 -07:00
});
});