Skip to content

Commit 860660c

Browse files
DanielSiepmannffMathy
authored andcommitted
Add broken test for issue #45 (#60)
1 parent cb38ce9 commit 860660c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

spec/issues/45.test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
});

0 commit comments

Comments
 (0)