From 8225bb935fb249ddf0010f32b0f34a370e3c3892 Mon Sep 17 00:00:00 2001 From: Elliot Nelson Date: Mon, 20 May 2019 09:09:07 -0400 Subject: [PATCH] Explicitly test pretty printing objects with nested invalid toString --- spec/core/PrettyPrintSpec.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/core/PrettyPrintSpec.js b/spec/core/PrettyPrintSpec.js index 64dea0fd..4accef96 100644 --- a/spec/core/PrettyPrintSpec.js +++ b/spec/core/PrettyPrintSpec.js @@ -344,8 +344,12 @@ describe("jasmineUnderTest.pp", function () { }, bar: { toString: function() { - // Invalid: toString returning an object - return new Error("bar"); + // Really invalid: a nested bad toString(). + return { + toString: function() { + return new Date(); + } + }; } }, // Valid: an actual number @@ -354,6 +358,6 @@ describe("jasmineUnderTest.pp", function () { qux: new Error("bar") }; - expect(jasmineUnderTest.pp(obj)).toEqual("Object({ foo: [object Number], bar: [object Error], baz: 3, qux: Error: bar })"); + expect(jasmineUnderTest.pp(obj)).toEqual("Object({ foo: [object Number], bar: [object Object], baz: 3, qux: Error: bar })"); }); });