Skip coverage for untestable code (#83)

This way we can get to 100% code coverage. 100% coverage is great
because it gives a clear indicator when there has been a coverage
regression, and it makes explicit which code you are choosing not to
test (through inline coverage disable comments) rather than implicit
(in lower percentages of coverage in the report).
This commit is contained in:
Hans Bergren
2020-01-22 17:40:43 -05:00
parent 03b68e8a53
commit f8e80f7132
2 changed files with 3 additions and 0 deletions

View File

@@ -104,6 +104,7 @@ function deriveKeypair(seed, options) {
const keypair = method.deriveKeypair(decoded.bytes, options)
const messageToVerify = hash('This test message should verify.')
const signature = method.sign(messageToVerify, keypair.privateKey)
/* istanbul ignore if */
if (method.verify(messageToVerify, signature, keypair.publicKey) !== true) {
throw new Error('derived keypair did not generate verifiable signature')
}

View File

@@ -15,10 +15,12 @@ function deriveScalar(bytes, discrim?: number) {
}
hasher.addU32(i)
const key = hasher.first256BN()
/* istanbul ignore else */
if (key.cmpn(0) > 0 && key.cmp(order) < 0) {
return key
}
}
/* istanbul ignore next */
throw new Error('impossible unicorn ;)')
}