File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed
Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change 1- import test from ' ava' ;
1+ import test from " ava" ;
22
3- import { Substitute , Arg } from ' ../../src/Index' ;
3+ import { Substitute , Arg } from " ../../src/Index" ;
44
55interface CalculatorInterface {
6- add ( a : number , b : number ) : number
7- subtract ( a : number , b : number ) : number
8- divide ( a : number , b : number ) : number
9- isEnabled : boolean
6+ add ( a : number , b : number ) : number ;
7+ subtract ( a : number , b : number ) : number ;
8+ divide ( a : number , b : number ) : number ;
9+ isEnabled : boolean ;
1010}
1111
12- test ( ' issue 23: mimick received should not call method' , t => {
13- const mockedCalculator = Substitute . for < CalculatorInterface > ( ) ;
12+ test ( " issue 23: mimick received should not call method" , t => {
13+ const mockedCalculator = Substitute . for < CalculatorInterface > ( ) ;
1414
15- let result = 0 ;
16- mockedCalculator . add ( Arg . all ( ) ) . mimicks ( ( a , b ) => {
17- return result = a + b ;
18- } ) ;
15+ mockedCalculator . add ( Arg . all ( ) ) . mimicks ( ( a , b ) => {
16+ t . deepEqual ( a , 1 ) ;
17+ return a + b ;
18+ } ) ;
1919
20- t . throws ( ( ) => mockedCalculator . received ( ) . add ( Arg . any ( ) , Arg . any ( ) ) ) ;
20+ mockedCalculator . add ( 1 , 1 ) ; // ok
2121
22- t . is ( result , 0 ) ;
23- } ) ;
22+ mockedCalculator . received ( 1 ) . add ( 2 , 1 ) ; // not ok, calls mimick func
23+ } ) ;
You can’t perform that action at this time.
0 commit comments