@@ -112,14 +112,20 @@ test('class method received', t => {
112112 t . notThrows ( ( ) => substitute [ received ] ( 1 ) . c ( 'hi' , 'the1re' ) )
113113 t . notThrows ( ( ) => substitute [ received ] ( ) . c ( 'hi' , 'there' ) )
114114
115- const expectedMessage = 'Expected 7 calls to the method c with arguments [\'hi\', \'there\'], but received 4 of such calls.\n' +
116- 'All calls received to method c:\n' +
117- '-> call with arguments [\'hi\', \'there\']\n' +
118- '-> call with arguments [\'hi\', \'the1re\']\n' +
119- '-> call with arguments [\'hi\', \'there\']\n' +
120- '-> call with arguments [\'hi\', \'there\']\n' +
121- '-> call with arguments [\'hi\', \'there\']'
122- const { message } = t . throws ( ( ) => { substitute [ received ] ( 7 ) . c ( 'hi' , 'there' ) } )
115+ const expectedMessage = 'Call count mismatch in @Substitute.c:\n' +
116+ `Expected to receive 7 method calls matching c('hi', 'there'), but received 4.\n` +
117+ 'All property or method calls to @Substitute.c received so far:\n' +
118+ `› ✔ @Substitute.c('hi', 'there')\n` +
119+ ` called at <anonymous> (${ process . cwd ( ) } /spec/regression/index.test.ts:114:18)\n` +
120+ `› ✘ @Substitute.c('hi', 'the1re')\n` +
121+ ` called at <anonymous> (${ process . cwd ( ) } /spec/regression/index.test.ts:115:18)\n` +
122+ `› ✔ @Substitute.c('hi', 'there')\n` +
123+ ` called at <anonymous> (${ process . cwd ( ) } /spec/regression/index.test.ts:116:18)\n` +
124+ `› ✔ @Substitute.c('hi', 'there')\n` +
125+ ` called at <anonymous> (${ process . cwd ( ) } /spec/regression/index.test.ts:117:18)\n` +
126+ `› ✔ @Substitute.c('hi', 'there')\n` +
127+ ` called at <anonymous> (${ process . cwd ( ) } /spec/regression/index.test.ts:118:18)\n`
128+ const { message } = t . throws ( ( ) => { substitute . received ( 7 ) . c ( 'hi' , 'there' ) } )
123129 t . is ( message . replace ( textModifierRegex , '' ) , expectedMessage )
124130} )
125131
@@ -133,10 +139,12 @@ test('received call matches after partial mocks using property instance mimicks'
133139 substitute [ received ] ( 1 ) . c ( 'lala' , 'bar' )
134140
135141 t . notThrows ( ( ) => substitute [ received ] ( 1 ) . c ( 'lala' , 'bar' ) )
136- const expectedMessage = 'Expected 2 calls to the method c with arguments [\'lala\', \'bar\'], but received 1 of such calls.\n' +
137- 'All calls received to method c:\n' +
138- '-> call with arguments [\'lala\', \'bar\']'
139- const { message } = t . throws ( ( ) => substitute [ received ] ( 2 ) . c ( 'lala' , 'bar' ) )
142+ const expectedMessage = 'Call count mismatch in @Substitute.c:\n' +
143+ `Expected to receive 2 method calls matching c('lala', 'bar'), but received 1.\n` +
144+ 'All property or method calls to @Substitute.c received so far:\n' +
145+ `› ✔ @Substitute.c('lala', 'bar')\n` +
146+ ` called at <anonymous> (${ process . cwd ( ) } /spec/regression/index.test.ts:145:13)\n`
147+ const { message } = t . throws ( ( ) => substitute . received ( 2 ) . c ( 'lala' , 'bar' ) )
140148 t . is ( message . replace ( textModifierRegex , '' ) , expectedMessage )
141149 t . deepEqual ( substitute . d , 1337 )
142150} )
0 commit comments