[英]ts-mockito mocked promise never resolves
鉴于这种
beforeAll(() => {
testContainer.register(Beans.CEC_LOCATION, {
useFactory: (c) => {
const contextMock = mock<ContentfulEntryContext<ContentfulLocationFields>>();
const entryMock = mock<Entry<ContentfulLocationFields>>();
when(entryMock.fields).thenReturn({
id: '42',
name: 'Deep Mind',
});
when(contextMock.get()).thenResolve(instance(entryMock));
const location = (id: string) => {
return instance(contextMock);
};
location('42').get().then((v) => console.log(v));
return location;
},
});
});
当location.get()
被调用, then
从未做出决议,即使是在60年代超时,拒绝似乎工作。 我究竟做错了什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.