Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 21 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { HistoryManager } from '@/lib/HistoryManager'; |
||
2 | import { existsSync, unlinkSync } from 'fs'; |
||
3 | |||
4 | it('loads run history from file', () => { |
||
5 | const historyManager = new HistoryManager(`${__dirname}/../fixtures/history.json`); |
||
6 | |||
7 | expect(historyManager.data).toHaveLength(2); |
||
8 | }); |
||
9 | |||
10 | it('saves to a new file if it does not exist', () => { |
||
11 | const filename = `${__dirname}/../fixtures/temp/history.json`; |
||
12 | if (existsSync(filename)) { |
||
13 | unlinkSync(filename); |
||
14 | } |
||
15 | |||
16 | const historyManager = new HistoryManager(filename); |
||
17 | |||
18 | expect(historyManager.data).toHaveLength(0); |
||
19 | expect(existsSync(filename)).toBeTruthy(); |
||
20 | }); |
||
21 |