mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-22 17:50:09 +01:00
Add constants.js
This commit is contained in:
parent
d8cb13ba91
commit
9bc0773b4e
32
test/constants.js
Normal file
32
test/constants.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import test from 'ava'
|
||||||
|
import { Transaction, Ed25519Keypair } from '../src'
|
||||||
|
// TODO: Find out if ava has something like conftest, if so put this there.
|
||||||
|
|
||||||
|
// TODO: We're adding `Math.random()` here to never create the same transaction
|
||||||
|
// twice.
|
||||||
|
export const assetMessage = { assetMessage: Math.random() }
|
||||||
|
export const metaDataMessage = { metaDataMessage: 'metaDataMessage' }
|
||||||
|
|
||||||
|
export const alice = new Ed25519Keypair()
|
||||||
|
export const aliceCondition = Transaction.makeEd25519Condition(alice.publicKey)
|
||||||
|
export const aliceOutput = Transaction.makeOutput(aliceCondition)
|
||||||
|
export const createTx = Transaction.makeCreateTransaction(
|
||||||
|
assetMessage,
|
||||||
|
metaDataMessage,
|
||||||
|
[aliceOutput],
|
||||||
|
alice.publicKey
|
||||||
|
)
|
||||||
|
export const transferTx = Transaction.makeTransferTransaction(
|
||||||
|
createTx,
|
||||||
|
metaDataMessage,
|
||||||
|
[aliceOutput],
|
||||||
|
0
|
||||||
|
)
|
||||||
|
|
||||||
|
export const bob = new Ed25519Keypair()
|
||||||
|
export const bobCondition = Transaction.makeEd25519Condition(bob.publicKey)
|
||||||
|
export const bobOutput = Transaction.makeOutput(bobCondition)
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: https://github.com/avajs/ava/issues/1190
|
||||||
|
test('', () => 'dirty hack. TODO: Exclude this file from being run by ava')
|
@ -5,25 +5,15 @@ import { Transaction, Ed25519Keypair } from '../../src'
|
|||||||
import * as makeTransaction from '../../src/transaction/makeTransaction' // eslint-disable-line
|
import * as makeTransaction from '../../src/transaction/makeTransaction' // eslint-disable-line
|
||||||
import makeInputTemplate from '../../src/transaction/makeInputTemplate'
|
import makeInputTemplate from '../../src/transaction/makeInputTemplate'
|
||||||
|
|
||||||
|
import {
|
||||||
// TODO: Find out if ava has something like conftest, if so put this there.
|
alice,
|
||||||
const alice = new Ed25519Keypair()
|
aliceCondition,
|
||||||
const aliceCondition = Transaction.makeEd25519Condition(alice.publicKey)
|
aliceOutput,
|
||||||
const aliceOutput = Transaction.makeOutput(aliceCondition)
|
|
||||||
const assetMessage = { assetMessage: 'assetMessage' }
|
|
||||||
const metaDataMessage = { metaDataMessage: 'metaDataMessage' }
|
|
||||||
const createTx = Transaction.makeCreateTransaction(
|
|
||||||
assetMessage,
|
assetMessage,
|
||||||
metaDataMessage,
|
metaDataMessage,
|
||||||
[aliceOutput],
|
|
||||||
alice.publicKey
|
|
||||||
)
|
|
||||||
const transferTx = Transaction.makeTransferTransaction(
|
|
||||||
createTx,
|
createTx,
|
||||||
metaDataMessage,
|
transferTx
|
||||||
[aliceOutput],
|
} from '../constants'
|
||||||
0
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
test('Create valid output with default amount', t => {
|
test('Create valid output with default amount', t => {
|
||||||
|
Loading…
Reference in New Issue
Block a user