@@ -158,6 +158,41 @@ foobar`
158158 // Yeah, funky way to do a negated ansiless contains.
159159 expect ( ( ) => expectAnsilessContain ( error . message , `bar` ) ) . toThrow ( ) ;
160160 } ) ;
161+
162+ it ( "should contain actual and expected values when there's a single expectation remaining" , ( ) => {
163+ const matcher = It . matches ( ( ) => false , {
164+ getDiff : ( ) => ( { actual : 'actual' , expected : 'expected' } ) ,
165+ } ) ;
166+
167+ const expectation = new StrongExpectation ( 'foo' , [ matcher , matcher ] , {
168+ value : ':irrelevant:' ,
169+ } ) ;
170+
171+ const error = new UnexpectedCall (
172+ 'foo' ,
173+ [ 'any arg' , 'any arg' ] ,
174+ [ expectation ]
175+ ) ;
176+
177+ expect ( error . matcherResult ) . toEqual ( {
178+ actual : [ 'actual' , 'actual' ] ,
179+ expected : [ 'expected' , 'expected' ] ,
180+ } ) ;
181+ } ) ;
182+
183+ it ( 'should not contain actual and expected values when the expectation has no expected args' , ( ) => {
184+ const expectation = new StrongExpectation ( 'foo' , [ ] , {
185+ value : ':irrelevant:' ,
186+ } ) ;
187+
188+ const error = new UnexpectedCall (
189+ 'foo' ,
190+ [ 'any arg' , 'any arg' ] ,
191+ [ expectation ]
192+ ) ;
193+
194+ expect ( error . matcherResult ) . toBeUndefined ( ) ;
195+ } ) ;
161196 } ) ;
162197
163198 describe ( 'UnexpectedCalls' , ( ) => {
0 commit comments