Silence console.warn during old arg tests

This commit is contained in:
junderw 2019-06-17 13:02:09 +09:00
parent 691e4d15d1
commit 071e201a75
No known key found for this signature in database
GPG key ID: B256185D3A971908

View file

@ -102,7 +102,16 @@ function construct (f, dontSign, useOldSignArgs) {
return constructSign(f, txb, useOldSignArgs)
}
// TODO: Remove loop in v6
for (const useOldSignArgs of [ false, true ]) {
// Search for "// TODO: Remove me in v6"
// to find the second part of this console.warn replace
let consoleWarn;
if (useOldSignArgs) {
consoleWarn = console.warn;
// Silence console.warn during these tests
console.warn = () => undefined;
}
describe(`TransactionBuilder: useOldSignArgs === ${useOldSignArgs}`, () => {
// constants
const keyPair = ECPair.fromPrivateKey(Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex'))
@ -725,6 +734,10 @@ for (const useOldSignArgs of [ false, true ]) {
})
const txId2 = txb.build().getId()
assert.strictEqual(txId, txId2)
// TODO: Remove me in v6
if (useOldSignArgs) {
console.warn = consoleWarn;
}
})
})
})