mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
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:
@@ -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')
|
||||
}
|
||||
|
||||
@@ -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 ;)')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user