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 9ad5f83 commit e43a266Copy full SHA for e43a266
spec/issues/59.test.ts
@@ -0,0 +1,17 @@
1
+import test from 'ava';
2
+
3
+import { Substitute } from '../../src/index';
4
5
+interface IEcho {
6
+ echo(a: string): string
7
+ maybeEcho(a?: string): string
8
+}
9
10
+test('issue 59 - Mock function with optional parameters', (t) => {
11
+ const echoer = Substitute.for<IEcho>()
12
+ echoer.maybeEcho('foo').returns('bar')
13
+ echoer.maybeEcho().returns('baz')
14
15
+ t.is(echoer.maybeEcho('foo'), 'bar')
16
+ t.is(echoer.maybeEcho(), 'baz')
17
+})
0 commit comments