test: add awaits to rejects and resolves

This commit is contained in:
Jörg Krzeslak 2025-12-08 13:11:13 +01:00 committed by Laertes87
parent 84d7da0195
commit 826dc1062a
4 changed files with 6 additions and 6 deletions

View file

@ -55,7 +55,7 @@ describe("convert", () => {
test("should reject if execFile returns an error", async () => {
mockExecFile = (cmd, args, callback) => callback(new Error("fail"), "", "");
expect(
await expect(
convert("input.yaml", "yaml", "json", "output.json", undefined, mockExecFile),
).rejects.toMatch(/error: Error: fail/);
});
@ -63,7 +63,7 @@ describe("convert", () => {
test("should reject if writeFile fails", async () => {
// @ts-expect-error: property __promisify__ is missing
fs.writeFile = (path, data, cb) => cb(new Error("write fail"));
expect(
await expect(
convert("input.yaml", "yaml", "json", "output.json", undefined, (cmd, args, cb) =>
cb(null, "output-data", ""),
),