诺克投掷'AssertionError [ERR_ASSERTION]: Mocks not yet satisfied'



我试图使用以下代码使用nock来模拟 URIhttp://102.10.10.337:9391/v2.0/networks

const allowUnmocked = { allowUnmocked: true };
const networkScope = nock('http://102.10.10.337:9391/v2.0/', allowUnmocked)
.persist();
console.log(networkScope);
let checknock = networkScope.post('/networks')
.reply(200, (uri, networkPayload) => {
console.log('dockedd');
return {
network: {
'provider:physical_network': null,           
mtu: 1450
}
};
});
try {
checknock.done();
} catch (e) {
console.log(`boom! -> ${e}`); // pass exception object to error handler
} 

运行它时,我收到以下错误:

AssertionError [ERR_ASSERTION]: Mocks not yet satisfied

可能与重复使用/有关。

const networkScope = nock('http://102.10.10.337:9391/v2.0', allowUnmocked)
// ...
const checknock = networkScope.post('/networks')

最新更新