Skip to content

Commit 20f425b

Browse files
committed
test: confirm causes of error are thrown in an expected order
1 parent 7a98fc3 commit 20f425b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/content.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from "node:path";
22
import core from "@actions/core";
33
import { assert } from "chai";
4+
import { YAMLException } from "js-yaml";
45
import Config from "../src/config.js";
56
import Content from "../src/content.js";
67
import SlackError from "../src/errors.js";
@@ -190,6 +191,11 @@ describe("content", () => {
190191
err.message,
191192
"Invalid input! Failed to parse contents of the provided payload",
192193
);
194+
assert.isDefined(err.cause?.values);
195+
assert.equal(err.cause.values.length, 2);
196+
const [jsonError, yamlError] = err.cause.values;
197+
assert.isTrue(jsonError instanceof SyntaxError);
198+
assert.isTrue(yamlError instanceof YAMLException);
193199
} else {
194200
assert.fail("Failed to throw a SlackError", err);
195201
}

0 commit comments

Comments
 (0)