Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/// .persist()
scope = nock('http://example.test')
.persist()
.get('/')
.reply(200, 'Persisting all the way')
/// .pendingMocks()
strings = scope.pendingMocks()
strings = nock.pendingMocks()
if (!scope.isDone()) {
console.error('pending mocks: %j', scope.pendingMocks())
}
console.error('pending mocks: %j', nock.pendingMocks())
/// .activeMocks()
nock.activeMocks() // $ExpectType string[]
nock('http://example.test').activeMocks() // $ExpectType string[]
// Logging
google = nock('http://example.test').log(console.log)
// Restoring
nock.restore()
// Enable/Disable real HTTP request
nock.disableNetConnect()
nock.enableNetConnect()
// using a string
nock.enableNetConnect('example.test')
// or a RegExp
after(function accelerateTxMockedAfter() {
// make sure all nocks are cleared or consumed after the tests are complete
nock.activeMocks().should.be.empty();
});
before(function accelerateTxMockedBefore() {
nock.activeMocks().should.be.empty();
bitgo = new TestBitGo({ env: 'mock' });
bitgo.initializeTestVars();
bitgo.setValidate(false);
wallet = new Wallet(bitgo, { id: walletId, private: { keychains: [userKeypair, backupKeypair, bitgoKey] } });
wallet.bitgo = bitgo;
bgUrl = common.Environments[bitgo.getEnv()].uri;
smartBitUrl = common.Environments[bitgo.getEnv()].smartBitApiBaseUrl;
// try to get the min change size from the server, otherwise default to 0.1 BTC
// TODO: minChangeSize is not currently a constant defined on the client and should be added
minChangeSize = bitgo.getConstants().minChangeSize || 1e7;
});
// monkey patch the bitgo getConstants() function
const oldGetConstants = bitgo.__proto__.getConstants;
bitgo.__proto__.getConstants = () => ({
// child fee rate in this test is 31378 sat/kb
// so set the max fee rate just below that limit,
// but above the combined fee rate of 20000
maxFeeRate: 30000
});
yield wallet.accelerateTransaction({
transactionID: parentTxId,
feeRate,
walletPassphrase: TestBitGo.TEST_WALLET1_PASSCODE
});
nock.activeMocks().should.be.empty();
bitgo.__proto__.getConstants = oldGetConstants;
}));
});
after(function afterUpdatePassword() {
nock.activeMocks().should.be.empty();
});
});
after(function() {
nock.activeMocks().should.be.empty();
});
});
before(function beforeDescribe() {
nock.activeMocks().should.be.empty();
bitgo = new TestBitGo({ env: 'mock' });
bitgo.initializeTestVars();
bitgo.setValidate(false);
keychains = bitgo.keychains();
bgUrl = common.Environments[bitgo.getEnv()].uri;
});
before(co(function *() {
nock.activeMocks().should.be.empty();
bgUrl = common.Environments[bitgo.getEnv()].uri;
}));
after(function tokenDefinitionsAfter() {
nock.activeMocks().should.be.empty();
});
});
after(function() {
nock.activeMocks().should.be.empty();
});