11import test from 'ava' ;
2- import { Substitute , Arg } from '../src' ;
32import { inspect } from 'util'
43
4+ import { Substitute , Arg } from '../src' ;
5+ import { getCorrectConstructorDescriptor } from './util/compatibility' ;
6+
57interface Calculator {
68 add ( a : number , b : number ) : number ;
79 multiply ( a : number , b ?: number ) : number ;
@@ -28,7 +30,7 @@ test('returns a primitive value for method with specific arguments', t => {
2830
2931 t . is ( calculator . add ( 1 , 1 ) , 2 ) ;
3032 t . is ( calculator . add ( 1 , 1 ) , 2 ) ;
31- t . is ( inspect ( noResult . constructor ) , '[Function: SubstituteJS]' ) ;
33+ t . is ( inspect ( noResult . constructor ) , `[ ${ getCorrectConstructorDescriptor ( ) } SubstituteJS]` ) ;
3234} ) ;
3335
3436test ( 'returns a primitive value for method with specific arguments where the last argument is optional' , t => {
@@ -46,8 +48,8 @@ test('returns a primitive value for method with specific arguments where the las
4648 const noResult = calculator . multiply ( 2 , 2 ) ;
4749 const noResult2 = calculator . multiply ( 0 ) ;
4850
49- t . is ( inspect ( noResult . constructor ) , '[Function: SubstituteJS]' ) ;
50- t . is ( inspect ( noResult2 . constructor ) , '[Function: SubstituteJS]' ) ;
51+ t . is ( inspect ( noResult . constructor ) , `[ ${ getCorrectConstructorDescriptor ( ) } SubstituteJS]` ) ;
52+ t . is ( inspect ( noResult2 . constructor ) , `[ ${ getCorrectConstructorDescriptor ( ) } SubstituteJS]` ) ;
5153} ) ;
5254
5355test ( 'returns a primitive value for method with specific and conditional arguments' , t => {
@@ -97,7 +99,7 @@ test('returns a promise for method with specific arguments', async t => {
9799 const noResult = calculator . heavyOperation ( 1 , 1 , 1 ) ;
98100
99101 t . is ( result , true ) ;
100- t . is ( inspect ( noResult . constructor ) , '[Function: SubstituteJS]' ) ;
102+ t . is ( inspect ( noResult . constructor ) , `[ ${ getCorrectConstructorDescriptor ( ) } SubstituteJS]` ) ;
101103} ) ;
102104
103105test ( 'returns a promise for method with specific and conditional arguments' , async t => {
@@ -151,7 +153,7 @@ test('returns a primitive value on a property', t => {
151153
152154 t . is ( calculator . isEnabled , true ) ;
153155 t . is ( calculator . isEnabled , true ) ;
154- t . is ( inspect ( noResult . constructor ) , '[Function: SubstituteJS]' ) ;
156+ t . is ( inspect ( noResult . constructor ) , `[ ${ getCorrectConstructorDescriptor ( ) } SubstituteJS]` ) ;
155157} ) ;
156158
157159test ( 'returns a promise on a property' , async t => {
0 commit comments