Skip to content

Commit e43a266

Browse files
choobanffMathy
authored andcommitted
Test case for optional parameters (#61)
1 parent 9ad5f83 commit e43a266

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spec/issues/59.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)