mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2025-02-14 21:10:32 +01:00
Updated test/transaction/test_transaction.js
This commit is contained in:
parent
2e1c43bf92
commit
d7c3276e12
@ -2,8 +2,6 @@ import test from 'ava'
|
|||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
|
|
||||||
import { Transaction } from '../../src'
|
import { Transaction } from '../../src'
|
||||||
import * as makeTransaction from '../../src/transaction/makeTransaction' // eslint-disable-line
|
|
||||||
import makeInputTemplate from '../../src/transaction/makeInputTemplate'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
alice,
|
alice,
|
||||||
@ -70,7 +68,7 @@ test('makeOutput throws TypeError with incorrect amount type', t => {
|
|||||||
|
|
||||||
|
|
||||||
test('Create TRANSFER transaction based on CREATE transaction', t => {
|
test('Create TRANSFER transaction based on CREATE transaction', t => {
|
||||||
sinon.spy(makeTransaction, 'default')
|
sinon.spy(Transaction.makeTransaction, 'default')
|
||||||
|
|
||||||
Transaction.makeTransferTransaction(
|
Transaction.makeTransferTransaction(
|
||||||
createTx,
|
createTx,
|
||||||
@ -83,7 +81,7 @@ test('Create TRANSFER transaction based on CREATE transaction', t => {
|
|||||||
{ id: createTx.id },
|
{ id: createTx.id },
|
||||||
metaData,
|
metaData,
|
||||||
[aliceOutput],
|
[aliceOutput],
|
||||||
[makeInputTemplate(
|
[Transaction.makeInputTemplate(
|
||||||
[alice.publicKey],
|
[alice.publicKey],
|
||||||
{ output_index: 0, transaction_id: createTx.id }
|
{ output_index: 0, transaction_id: createTx.id }
|
||||||
)]
|
)]
|
||||||
@ -92,13 +90,13 @@ test('Create TRANSFER transaction based on CREATE transaction', t => {
|
|||||||
// NOTE: `src/transaction/makeTransaction` is `export default`, hence we
|
// NOTE: `src/transaction/makeTransaction` is `export default`, hence we
|
||||||
// can only mock `makeTransaction.default` with a hack:
|
// can only mock `makeTransaction.default` with a hack:
|
||||||
// See: https://stackoverflow.com/a/33676328/1263876
|
// See: https://stackoverflow.com/a/33676328/1263876
|
||||||
t.truthy(makeTransaction.default.calledWith(...expected))
|
t.truthy(Transaction.makeTransaction.default.calledWith(...expected))
|
||||||
makeTransaction.default.restore()
|
Transaction.makeTransaction.default.restore()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
test('Create TRANSFER transaction based on TRANSFER transaction', t => {
|
test('Create TRANSFER transaction based on TRANSFER transaction', t => {
|
||||||
sinon.spy(makeTransaction, 'default')
|
sinon.spy(Transaction.makeTransaction, 'default')
|
||||||
|
|
||||||
Transaction.makeTransferTransaction(
|
Transaction.makeTransferTransaction(
|
||||||
transferTx,
|
transferTx,
|
||||||
@ -111,12 +109,12 @@ test('Create TRANSFER transaction based on TRANSFER transaction', t => {
|
|||||||
{ id: transferTx.asset.id },
|
{ id: transferTx.asset.id },
|
||||||
metaData,
|
metaData,
|
||||||
[aliceOutput],
|
[aliceOutput],
|
||||||
[makeInputTemplate(
|
[Transaction.makeInputTemplate(
|
||||||
[alice.publicKey],
|
[alice.publicKey],
|
||||||
{ output_index: 0, transaction_id: transferTx.id }
|
{ output_index: 0, transaction_id: transferTx.id }
|
||||||
)]
|
)]
|
||||||
]
|
]
|
||||||
|
|
||||||
t.truthy(makeTransaction.default.calledWith(...expected))
|
t.truthy(Transaction.makeTransaction.default.calledWith(...expected))
|
||||||
makeTransaction.default.restore()
|
Transaction.makeTransaction.default.restore()
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user