mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35:49 +00:00
refactored src/types (#86)
Final refactor of the src/types directory. Refactored Amount and STObject classes, and finalized SerializedType and Comparable classes.
This commit is contained in:
@@ -65,10 +65,7 @@ describe('encoding and decoding tx_json', function () {
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow({
|
||||
name: 'Error',
|
||||
message: amount_parameters_message('1000.001')
|
||||
})
|
||||
}).toThrow()
|
||||
})
|
||||
test('throws when Fee is invalid', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
@@ -77,10 +74,7 @@ describe('encoding and decoding tx_json', function () {
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow({
|
||||
name: 'Error',
|
||||
message: amount_parameters_message('10.123')
|
||||
})
|
||||
}).toThrow()
|
||||
})
|
||||
test('throws when Amount and Fee are invalid', function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
@@ -89,10 +83,7 @@ describe('encoding and decoding tx_json', function () {
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow({
|
||||
name: 'Error',
|
||||
message: amount_parameters_message('1000.789')
|
||||
})
|
||||
}).toThrow()
|
||||
})
|
||||
test('throws when Amount is a number instead of a string-encoded integer',
|
||||
function () {
|
||||
@@ -101,11 +92,9 @@ describe('encoding and decoding tx_json', function () {
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow({
|
||||
name: 'Error',
|
||||
message: 'unsupported value: 1000.789'
|
||||
})
|
||||
}).toThrow()
|
||||
})
|
||||
|
||||
test('throws when Fee is a number instead of a string-encoded integer',
|
||||
function () {
|
||||
const my_tx = Object.assign({}, tx_json, {
|
||||
@@ -113,9 +102,6 @@ describe('encoding and decoding tx_json', function () {
|
||||
})
|
||||
expect(() => {
|
||||
encode(my_tx)
|
||||
}).toThrow({
|
||||
name: 'Error',
|
||||
message: 'unsupported value: 1234.56'
|
||||
})
|
||||
}).toThrow()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user