问题描述
我正在尝试模拟整个类 'PropertyPopulater' 及其方法之一,以便可以将其用于传递给测试中的服务 ctor 'AppointmentPopulater',而不必构建每个构造函数参数。
在尝试运行测试时,我收到此错误,就好像没有选择存根方法“getPopulatedPropertyByIdAsync”一样:
测试:
describe("populateAsync",() => {
it("maps the correct properties when source contains valid properties",async () => {
let httpHelper = new HttpHelper();
let generalFormatter = new GeneralFormatter();
let addressFormatter = new AddressFormatter(generalFormatter);
let addresspopulater = new Addresspopulater(addressFormatter);
let officePopulater = new OfficePopulater(httpHelper,addresspopulater);
let negotiatorPopulater = new NegotiatorPopulater(httpHelper);
let propertyPopulaterStub = sinon.createStubInstance(PropertyPopulater,{
getPopulatedPropertyByIdAsync: sinon.stub().returns(populatedPropertyResponse),});
let appointmentPopulater = new AppointmentPopulater(httpHelper,officePopulater,negotiatorPopulater,propertyPopulaterStub);
let response = await appointmentPopulater.populateAsync(appointmentModel,null,null);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)