【发布时间】:2020-10-12 07:18:39
【问题描述】:
我在 Jest 中有一个抛出异常并通过测试的测试
await expect(hotelService.getByIdAsync(Identifier)).rejects.toThrow(FunctionalError);
但是当我这样做时
const action = async () => {
await hotelService.getByIdAsync(Identifier);
};
expect(action).toThrowError(FunctionalError);
我有这个结果:Received function did not throw
【问题讨论】:
标签: javascript node.js typescript async-await jestjs