Skip to content

Commit e0dec35

Browse files
committed
Added more readHistoryFile vitests
1 parent f3d2730 commit e0dec35

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

vitest/tests/utils.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ describe("readHistoryFile", () => {
139139
expect(result).toEqual(mockData);
140140
});
141141

142+
it("should return an empty object when history file does not exist", () => {
143+
vi.spyOn(fs, "existsSync").mockReturnValue(false);
144+
const result = utils.readHistoryFile();
145+
expect(result).toEqual({});
146+
});
147+
142148
it("should return an empty object when fs.readFileSync throws an error", () => {
143149
vi.spyOn(fs, "existsSync").mockReturnValue(true);
144150
vi.spyOn(fs, "readFileSync").mockImplementation(() => {

0 commit comments

Comments
 (0)