pseudo-transaction.test.js 843 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. const { encode, decode } = require('../dist')
  2. let json = {
  3. Account: 'rrrrrrrrrrrrrrrrrrrrrhoLvTp',
  4. Sequence: 0,
  5. Fee: '0',
  6. SigningPubKey: '',
  7. Signature: '',
  8. }
  9. let json_blank_acct = {
  10. Account: '',
  11. Sequence: 0,
  12. Fee: '0',
  13. SigningPubKey: '',
  14. Signature: '',
  15. }
  16. let binary =
  17. '24000000006840000000000000007300760081140000000000000000000000000000000000000000'
  18. describe('Can encode Pseudo Transactions', () => {
  19. test('Correctly encodes Pseudo Transaciton', () => {
  20. expect(encode(json)).toEqual(binary)
  21. })
  22. test('Can decode account objects', () => {
  23. expect(decode(encode(json))).toEqual(json)
  24. })
  25. test('Blank AccountID is ACCOUNT_ZERO', () => {
  26. expect(encode(json_blank_acct)).toEqual(binary)
  27. })
  28. test('Decodes Blank AccountID', () => {
  29. expect(decode(encode(json_blank_acct))).toEqual(json)
  30. })
  31. })