We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e9f15c commit f67cf2fCopy full SHA for f67cf2f
spec/issues/51.test.ts
@@ -0,0 +1,21 @@
1
+import test from 'ava';
2
+
3
+import { Substitute, Arg } from '../../src/index';
4
5
+interface ICalculator {
6
+ add(a: number, b: number): number;
7
+ divide(a: number, b: number): number;
8
+}
9
+test('issue 51 - All functions shares the same state', async t => {
10
+ const calculator = Substitute.for<ICalculator>();
11
+ calculator.add(1, 2).returns(4);
12
13
+ const result = calculator.add(1, 2);
14
+ t.is(result, 4);
15
+ try {
16
+ calculator.received().divide(1, 2);
17
+ t.fail('Expected to have failed.');
18
+ } catch (e) {
19
+ t.regex(e.toString(), /Expected 1 or more calls to the property divide with no arguments/);
20
+ }
21
+});
0 commit comments