Skip to content

Commit dde51e0

Browse files
committed
up
1 parent d2d3ac5 commit dde51e0

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

tests/helpers.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,10 @@ export async function editInput(input: HTMLInputElement | HTMLTextAreaElement, v
219219
return nextTick();
220220
}
221221

222-
const noReturnValue = Symbol();
223-
export function expectSpy(
224-
spy: jest.Mock,
225-
callTime: number,
226-
args: any[],
227-
returnValue: any = noReturnValue
228-
): void {
229-
expect(spy).toHaveBeenCalledTimes(callTime);
230-
expect(spy).lastCalledWith(...args);
231-
!noReturnValue && expect(spy).toHaveReturnedWith(returnValue);
222+
export function expectSpy(spy: jest.Mock, count: number, opt: { args: any[]; result?: any }): void {
223+
expect(spy).toHaveBeenCalledTimes(count);
224+
if ("args" in opt) expect(spy).lastCalledWith(...opt.args);
225+
if ("result" in opt) expect(spy).toHaveReturnedWith(opt.result);
232226
}
233227

234228
afterEach(() => {

0 commit comments

Comments
 (0)