mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-08 23:05:49 +00:00
- Convert tests to typescript - Update type definitions causing errors in tests - `makeParser` to accept a `Buffer` in addition to `string` - `SerializedType` constructor allows not passing in a byte array - `Comparable` is now a generic type so that it allows `compareTo` methods to take more that the type itself. Example: `Uint64.compareTo` can accept `number` - Update tests to use jasmine compatible functions - Switching from `test` to `it`. - Updated test checking if coretypes all implement SerializedType - Import fixtures directly instead of using `loadFixture` utility - Remove importing of `buffer/` explicitly. It was throwing off type checking in tests. Buffer is going away in a future PR anyway. - Fixed `npm run clean` not clearing `.tsbuildinfo` files for keypairs - Remove unused account-tx-transactions.db. It was likely used in the past to test historical ledgers.
39 lines
829 B
TypeScript
39 lines
829 B
TypeScript
import { encode, decode } from '../src'
|
|
|
|
let json = {
|
|
Account: 'rrrrrrrrrrrrrrrrrrrrrhoLvTp',
|
|
Sequence: 0,
|
|
Fee: '0',
|
|
SigningPubKey: '',
|
|
Signature: '',
|
|
}
|
|
|
|
let json_blank_acct = {
|
|
Account: '',
|
|
Sequence: 0,
|
|
Fee: '0',
|
|
SigningPubKey: '',
|
|
Signature: '',
|
|
}
|
|
|
|
let binary =
|
|
'24000000006840000000000000007300760081140000000000000000000000000000000000000000'
|
|
|
|
describe('Can encode Pseudo Transactions', () => {
|
|
it('Correctly encodes Pseudo Transaciton', () => {
|
|
expect(encode(json)).toEqual(binary)
|
|
})
|
|
|
|
it('Can decode account objects', () => {
|
|
expect(decode(encode(json))).toEqual(json)
|
|
})
|
|
|
|
it('Blank AccountID is ACCOUNT_ZERO', () => {
|
|
expect(encode(json_blank_acct)).toEqual(binary)
|
|
})
|
|
|
|
it('Decodes Blank AccountID', () => {
|
|
expect(decode(encode(json_blank_acct))).toEqual(json)
|
|
})
|
|
})
|