mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Fix deriveXAddress null behavior (#1964)
* Fix deriveXAddress null behavior * Also check for undefined * Simplify theTag * Add test case for undefined
This commit is contained in:
@@ -22,4 +22,30 @@ describe('deriveXAddress', function () {
|
||||
'TVVrSWtmQQssgVcmoMBcFQZKKf56QscyWLKnUyiuZW8ALU4',
|
||||
)
|
||||
})
|
||||
|
||||
it('does not include tag when null', function () {
|
||||
assert.equal(
|
||||
deriveXAddress({
|
||||
publicKey:
|
||||
'ED02C98225BD1C79E9A4F95C6978026D300AFB7CA2A34358920BCFBCEBE6AFCD6A',
|
||||
// @ts-expect-error -- Assessing null behavior (Common js mistake)
|
||||
tag: null,
|
||||
test: false,
|
||||
}),
|
||||
'X7FbrqVEqdTNoX5qq94rTdarGjeVYmkxi8A1TKAJUnyLL9g',
|
||||
)
|
||||
})
|
||||
|
||||
it('does not include tag when undefined', function () {
|
||||
assert.equal(
|
||||
deriveXAddress({
|
||||
publicKey:
|
||||
'ED02C98225BD1C79E9A4F95C6978026D300AFB7CA2A34358920BCFBCEBE6AFCD6A',
|
||||
// @ts-expect-error -- Assessing undefined behavior
|
||||
tag: undefined,
|
||||
test: false,
|
||||
}),
|
||||
'X7FbrqVEqdTNoX5qq94rTdarGjeVYmkxi8A1TKAJUnyLL9g',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user