File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ import test from 'ava' ;
2+
3+ import { Substitute , Arg } from '../../src/index' ;
4+
5+ class DependencyClass {
6+ public methodOne ( ) { }
7+ public methodTwo ( someArg : string ) { }
8+ }
9+
10+ class SubjectClass {
11+ private readonly dependency : DependencyClass ;
12+
13+ public constructor ( dependency : DependencyClass ) {
14+ this . dependency = dependency ;
15+ }
16+
17+ public callToMethodOne ( ) {
18+ this . dependency . methodOne ( ) ;
19+ }
20+ public callToMethodTwo ( ) {
21+ this . dependency . methodTwo ( 'string' ) ;
22+ }
23+ }
24+
25+ test ( 'issue 45 Checking received calls off at times' , async t => {
26+ const mock = Substitute . for < DependencyClass > ( ) ;
27+ const subject = new SubjectClass ( mock ) ;
28+
29+ subject . callToMethodOne ( ) ;
30+ subject . callToMethodTwo ( ) ;
31+
32+ t . notThrows ( ( ) => {
33+ mock . received ( 1 ) . methodOne ( ) ;
34+ mock . received ( 1 ) . methodTwo ( Arg . is ( x => x === 'string' ) ) ;
35+ } ) ;
36+ } ) ;
You can’t perform that action at this time.
0 commit comments