const allowUnmocked = { allowUnmocked: true };
const networkScope = nock('http://102.10.10.337:9391/v2.0/',allowUnmocked) 。坚持(); 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
}
基本上,我正在尝试模拟URI:http://102.10.10.337:9391/v2.0/networks 但是我遇到了类似的错误:
AssertionError [ERR_ASSERTION]:尚不满意。我要去哪里错了?
答案 0 :(得分:0)
可能与重复使用/
有关。
const networkScope = nock('http://102.10.10.337:9391/v2.0', allowUnmocked)
// ...
const checknock = networkScope.post('/networks')