Skip to content

Enhance crypto/hash.js coverage

Added these case

crypto.Hash
  • Call constructor without new keyword
crypto.Hmac
  • Call constructor without new keyword
  • Call constructor with typeof hmac != string
  • Call constructor with typeof hmac = string, typeof key != string

Current coverage is here: https://coverage.nodejs.org/coverage-06e1b0386196f8f8/root/internal/crypto/hash.js.html

I cannot write test case: this._handle.update returns false in Hash#verify. Because I don't know how to make mdctx_ to nullptr in Hash::HashUpdate. See also:

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Merge request reports

Loading