本文整理匯總了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();
};