Skip to content

Commit

Permalink
test: writeFileSafely関数のエラーハンドリングテストを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Jan 24, 2025
1 parent b09ceb1 commit ff477bf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/unit/backend/electron/fileHelper.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ describe("writeFileSafely", () => {
const filePath = path.join(nonExistentDir, "test.txt");
expect(() => writeFileSafely(filePath, "data")).toThrow();
});

test("指定したパスにディレクトリが存在するとエラー", async () => {
const filePath = path.join(tmpDir, uuid4());
fs.mkdirSync(filePath);
expect(() => writeFileSafely(filePath, "data")).toThrow();
});
});

0 comments on commit ff477bf

Please sign in to comment.