Skip to content

Commit 2899b65

Browse files
committed
test: add awaits to rejects and resolves
1 parent 1b25439 commit 2899b65

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

tests/converters/dasel.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ describe("convert", () => {
5555

5656
test("should reject if execFile returns an error", async () => {
5757
mockExecFile = (cmd, args, callback) => callback(new Error("fail"), "", "");
58-
expect(
58+
await expect(
5959
convert("input.yaml", "yaml", "json", "output.json", undefined, mockExecFile),
6060
).rejects.toMatch(/error: Error: fail/);
6161
});
6262

6363
test("should reject if writeFile fails", async () => {
6464
// @ts-expect-error: property __promisify__ is missing
6565
fs.writeFile = (path, data, cb) => cb(new Error("write fail"));
66-
expect(
66+
await expect(
6767
convert("input.yaml", "yaml", "json", "output.json", undefined, (cmd, args, cb) =>
6868
cb(null, "output-data", ""),
6969
),

tests/converters/libreoffice.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ test("strips leading './' from outdir", async () => {
108108
// --- promise settlement ------------------------------------------------------
109109
test("resolves with 'Done' when execFile succeeds", async () => {
110110
behavior = { kind: "success", stdout: "fine", stderr: "" };
111-
expect(convert("in.txt", "txt", "docx", "out/out.docx", undefined, mockExecFile)).resolves.toBe(
111+
await expect(convert("in.txt", "txt", "docx", "out/out.docx", undefined, mockExecFile)).resolves.toBe(
112112
"Done",
113113
);
114114
});
115115

116116
test("rejects when execFile returns an error", async () => {
117117
behavior = { kind: "error", message: "convert failed", stderr: "oops" };
118-
expect(convert("in.txt", "txt", "docx", "out/out.docx", undefined, mockExecFile)).rejects.toMatch(
118+
await expect(convert("in.txt", "txt", "docx", "out/out.docx", undefined, mockExecFile)).rejects.toMatch(
119119
/error: Error: convert failed/,
120120
);
121121
});

tests/converters/pandoc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe("convert", () => {
5959

6060
test("should reject if execFile returns an error", async () => {
6161
mockExecFile = (cmd, args, callback) => callback(new Error("fail"), "", "");
62-
expect(
62+
await expect(
6363
convert("input.md", "markdown", "html", "output.html", undefined, mockExecFile),
6464
).rejects.toMatch(/error: Error: fail/);
6565
});

tests/converters/vtracer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe("convert", () => {
5151

5252
test("should reject if execFile returns an error", async () => {
5353
mockExecFile = (cmd, args, callback) => callback(new Error("fail"), "", "stderr output");
54-
expect(
54+
await expect(
5555
convert("input.png", "png", "svg", "output.svg", undefined, mockExecFile),
5656
).rejects.toMatch(/error: Error: fail\nstderr: stderr output/);
5757
});

0 commit comments

Comments
 (0)