test(SyncHook): tapAsync and tapPromise should throw

This commit is contained in:
noscripter 2019-07-22 19:22:29 +08:00
parent d84786acf1
commit 1fd8cdd06a

View File

@ -101,4 +101,14 @@ describe("SyncHook", () => {
expect(mock2).not.toHaveBeenLastCalledWith(1, 2);
expect(mock0).toHaveBeenLastCalledWith(1, 2);
});
it('should throw error on tapAsync', () => {
const hook = new SyncHook(["arg1", "arg2"]);
expect(() => hook.tapAsync()).toThrow(/tapAsync/)
})
it('should throw error on tapPromise', () => {
const hook = new SyncHook(["arg1", "arg2"]);
expect(() => hook.tapPromise()).toThrow(/tapPromise/)
})
});