mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-15 10:05:48 +00:00
[ripple-binary-codec] fix ISO when parsing currency code (#1921)
This commit is contained in:
@@ -50,7 +50,7 @@ describe('Hash256', function () {
|
||||
})
|
||||
|
||||
describe('Currency', function () {
|
||||
test('Will throw an error for dodgy XRP ', function () {
|
||||
test('Will throw an error for dodgy XRP', function () {
|
||||
expect(() =>
|
||||
Currency.from('0000000000000000000000005852500000000000'),
|
||||
).toThrow()
|
||||
@@ -70,6 +70,18 @@ describe('Currency', function () {
|
||||
expect(Currency.from('USD').toJSON()).toBe('USD')
|
||||
})
|
||||
|
||||
test('Currency codes with no contiguous zeroes in first 96 type code & reserved bits', function () {
|
||||
expect(
|
||||
Currency.from('0000000023410000000000005852520000000000').iso(),
|
||||
).toBe(null)
|
||||
})
|
||||
|
||||
test('Currency codes with no contiguous zeroes in last 40 reserved bits', function () {
|
||||
expect(
|
||||
Currency.from('0000000000000000000000005852527570656500').iso(),
|
||||
).toBe(null)
|
||||
})
|
||||
|
||||
test('can be constructed from a Buffer', function () {
|
||||
const xrp = new Currency(Buffer.alloc(20))
|
||||
expect(xrp.iso()).toBe('XRP')
|
||||
|
||||
Reference in New Issue
Block a user