【发布时间】:2020-10-12 05:42:20
【问题描述】:
我已经创建了这个类:
export class ErrorList {
public HostelNotFoundError(details: ErrorDetail): FunctionalError {
return new FunctionalError('1', 'Can\'t find this hostel', details);
}
在服务中:
throw new ErrorList().HostelNotFoundError({} });
我想知道在 Jest 中是否可以做类似的事情:
rejects.toThrow(HostelNotFoundError);
【问题讨论】:
-
不是实际抛出的错误
FunctionalError吗?看看这个stackoverflow.com/questions/46042613/…
标签: javascript node.js typescript jestjs