本文整理汇总了TypeScript中Sinon.SinonStub.getCalls方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SinonStub.getCalls方法的具体用法?TypeScript SinonStub.getCalls怎么用?TypeScript SinonStub.getCalls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sinon.SinonStub
的用法示例。
在下文中一共展示了SinonStub.getCalls方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should show warning and throw Error", () => {
class WriteToTextlintrcUseCase extends UseCase {
static create() {
return new this();
}
constructor() {
super();
}
execute() {}
}
const dispatcher = new Dispatcher();
const context = new Context({
dispatcher,
store: createEchoStore({ name: "test", echo: { a: "a" } })
});
assert.throws(() => {
// @ts-ignore
context.useCase(WriteToTextlintrcUseCase.create).execute();
// ~~
// missing call ()
}, Error);
// assert warning message
assert(consoleErrorStub.called);
const warningMessage = consoleErrorStub.getCalls()[0].args[0];
assert(
warningMessage.indexOf("Warning(UseCase): This is wrong Functional UseCase.") !== -1,
warningMessage
);
});
示例2: assert
const finishCallBack = () => {
// childPayload should not be delegated to dispatcher(root)
assert(dispatchedPayloads.indexOf(childPayload) === -1);
// insteadof of it, should be display warning messages
assert(consoleErrorStub.called);
const warningMessage = consoleErrorStub.getCalls()[0].args[0];
assert(/Warning\(UseCase\):.*?is already released/.test(warningMessage), warningMessage);
done();
};