MCPcopy Create free account
hub / github.com/cryptii/cryptii / assertEqual

Method assertEqual

test/Helper/ChainUtil.js:19–32  ·  view source on GitHub ↗

* Asserts Chain objects to be equal. Compares the actual string or the hex * representation to display useful feedback if assertion fails. * @param {mixed} actual * @param {Chain} expected * @param {string} [message]

(actual, expected, message = undefined)

Source from the content-addressed store, hash-verified

17 * @param {string} [message]
18 */
19 static assertEqual (actual, expected, message = undefined) {
20 assert.ok(actual instanceof Chain,
21 'Value is expected to be a Chain object.')
22
23 if (actual.needsByteEncoding()) {
24 // content is text encoded
25 assert.strictEqual(actual.getString(), expected.getString(), message)
26 } else {
27 // content is byte encoded
28 const actualString = ByteEncoder.hexStringFromBytes(actual.getBytes())
29 const expectedString = ByteEncoder.hexStringFromBytes(expected.getBytes())
30 assert.strictEqual(actualString, expectedString, message)
31 }
32 }
33
34 /**
35 * Creates string preview of given Chain object.

Callers 1

testMethod · 0.80

Calls 4

needsByteEncodingMethod · 0.80
getStringMethod · 0.80
hexStringFromBytesMethod · 0.80
getBytesMethod · 0.80

Tested by 1

testMethod · 0.64