run formatter
This commit is contained in:
1 parent
8d7c322279
commit
861d867a17
1 file changed
+6
-5
@@ -134,14 +134,15 @@ describe("AdvancedMatcher", () => {
|
|||||||
|
|
||||||
it("returns a distinct error when the extracted value cannot be coerced to a string", () => {
|
it("returns a distinct error when the extracted value cannot be coerced to a string", () => {
|
||||||
// An object with a throwing toString/valueOf (like Object.create(null)) makes String() throw.
|
// An object with a throwing toString/valueOf (like Object.create(null)) makes String() throw.
|
||||||
const unstringifiable = { toString: () => { throw new Error("nope"); } };
|
const unstringifiable = {
|
||||||
|
toString: () => {
|
||||||
|
throw new Error("nope");
|
||||||
|
},
|
||||||
|
};
|
||||||
const jmespath = { search: jest.fn().mockReturnValue(unstringifiable) };
|
const jmespath = { search: jest.fn().mockReturnValue(unstringifiable) };
|
||||||
const matcher = new AdvancedMatcher(jmespath as any);
|
const matcher = new AdvancedMatcher(jmespath as any);
|
||||||
|
|
||||||
const result = matcher.validate(
|
const result = matcher.validate({}, makeMonitor({ useAdvancedMatching: true, jsonPath: "field", matchMethod: "equal", expectedValue: "x" }));
|
||||||
{},
|
|
||||||
makeMonitor({ useAdvancedMatching: true, jsonPath: "field", matchMethod: "equal", expectedValue: "x" })
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(result.ok).toBe(false);
|
expect(result.ok).toBe(false);
|
||||||
expect(result.message).toBe("Error evaluating response value");
|
expect(result.message).toBe("Error evaluating response value");
|
||||||
|
|||||||
Reference in new issue
Block a user