鉴于这种
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 秒超时时,拒绝似乎也有效。我究竟做错了什么?