From 080d0095b47e00f1c1b2f53a6b6f6ec39a96a2ad Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Wed, 25 Jan 2017 09:21:49 +0100 Subject: [PATCH] Test that the list of spies contained in a stub instance is dotted out when it would exceed the available horizontal space. --- test/unexpected-sinon.spec.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/unexpected-sinon.spec.js b/test/unexpected-sinon.spec.js index c7dc4a2..0595af7 100644 --- a/test/unexpected-sinon.spec.js +++ b/test/unexpected-sinon.spec.js @@ -558,6 +558,26 @@ describe('unexpected-sinon', function () { "foo( 123 ); at theFunction (theFileName:xx:yy)" ); }); + + it('should dot out the list of contained spies when they exceed expect.output.preferredWidth', function () { + expect.output.preferredWidth = 45; + var stubInstance = sinon.createStubInstance(MyClass); + stubInstance.foo(123); + stubInstance.bar(456); + stubInstance.foo(123); + return expect(function () { + return expect(stubInstance, 'to have no calls satisfying', function () { + stubInstance.bar(456); + }); + }, 'to error with', + "expected MyClass({foo /* 1 more */})\n" + + "to have no calls satisfying bar( 456 );\n" + + "\n" + + "foo( 123 ); at theFunction (theFileName:xx:yy)\n" + + "bar( 456 ); at theFunction (theFileName:xx:yy) // should be removed\n" + + "foo( 123 ); at theFunction (theFileName:xx:yy)" + ); + }); }); describe('when passed a spec object', function () {