Skip to content

Commit

Permalink
integration tests: Rename ready to getSdk
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Jun 21, 2020
1 parent eb715cb commit 59d33bf
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions test/integration/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { describe, it, before } from 'mocha'
import { ready, BaseAe, networkId } from './'
import { getSdk, BaseAe, networkId } from './'
import { generateKeyPair } from '../../es/utils/crypto'
import BigNumber from 'bignumber.js'
import MemoryAccount from '../../es/account/memory'
Expand All @@ -26,7 +26,7 @@ describe('Accounts', function () {
let wallet

before(async function () {
wallet = await ready()
wallet = await getSdk()
})

const { publicKey: receiver } = generateKeyPair()
Expand All @@ -35,7 +35,7 @@ describe('Accounts', function () {
let wallet

before(async function () {
wallet = await ready()
wallet = await getSdk()
await wallet.addAccount(MemoryAccount({ keypair: generateKeyPair() }), { select: true })
})

Expand Down Expand Up @@ -185,7 +185,7 @@ describe('Accounts', function () {

describe('can be configured to return th', () => {
it('on creation', async () => {
const wallet = await ready()
const wallet = await getSdk()
const th = await wallet.spend(1, receiver)
th.should.be.a('object')
th.hash.slice(0, 3).should.equal('th_')
Expand Down
4 changes: 2 additions & 2 deletions test/integration/aens.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { describe, it, before } from 'mocha'
import { plan, ready } from './'
import { plan, getSdk } from './'
import * as R from 'ramda'
import { generateKeyPair } from '../../es/utils/crypto'
import { buildContractId, classify, computeAuctionEndBlock, computeBidFee } from '../../es/tx/builder/helpers'
Expand All @@ -43,7 +43,7 @@ describe('Aens', function () {
const name = randomName(13) // 13 name length doesn't trigger auction

before(async function () {
aens = await ready()
aens = await getSdk()
await aens.spend('1000000000000000', account.publicKey)
})

Expand Down
4 changes: 2 additions & 2 deletions test/integration/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
import { describe, it, before } from 'mocha'
import { ready } from './'
import { getSdk } from './'
import { generateKeyPair } from '../../es/utils/crypto'

describe('Node Chain', function () {
let client
const { publicKey } = generateKeyPair()

before(async function () {
client = await ready()
client = await getSdk()
})

it('determines the height', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { describe, it, before, after, beforeEach, afterEach } from 'mocha'
import * as sinon from 'sinon'
import BigNumber from 'bignumber.js'
import { ready, plan, BaseAe, networkId } from './'
import { getSdk, plan, BaseAe, networkId } from './'
import { generateKeyPair, encodeBase64Check } from '../../es/utils/crypto'
import { unpackTx, buildTx, buildTxHash } from '../../es/tx/builder'
import { decode } from '../../es/tx/builder/helpers'
Expand Down Expand Up @@ -83,7 +83,7 @@ describe('Channel', function () {
}

before(async function () {
initiator = await ready()
initiator = await getSdk()
responder = await BaseAe({ nativeMode: true, networkId, accounts: [] })
await responder.addAccount(MemoryAccount({ keypair: generateKeyPair() }), { select: true })
sharedParams.initiatorId = await initiator.address()
Expand Down
4 changes: 2 additions & 2 deletions test/integration/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
import Compiler from '../../es/contract/compiler'
import { describe, it, before } from 'mocha'
import { BaseAe, plan, ready, compilerUrl } from './'
import { BaseAe, plan, getSdk, compilerUrl } from './'
import { decode } from '../../es/tx/builder/helpers'

import * as R from 'ramda'
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('Contract', function () {
let deployed

before(async function () {
contract = await ready(true)
contract = await getSdk(true)
})
describe('Aens and Oracle operation delegation', () => {
let cInstance
Expand Down
4 changes: 2 additions & 2 deletions test/integration/ga.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { describe, it, before } from 'mocha'
import { ready } from './'
import { getSdk } from './'
import { generateKeyPair } from '../../es/utils/crypto'
import MemoryAccount from '../../es/account/memory'

Expand All @@ -34,7 +34,7 @@ describe('Generalize Account', function () {
const gaAccount = generateKeyPair()

before(async function () {
client = await ready()
client = await getSdk()
await client.spend('100000000000000000000', gaAccount.publicKey)
await client.addAccount(await MemoryAccount({ keypair: gaAccount }))
})
Expand Down
2 changes: 1 addition & 1 deletion test/integration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function plan (amount) {
planned = planned.plus(amount)
}

export async function ready (nativeMode = true) {
export async function getSdk (nativeMode = true) {
const ae = await BaseAe({ networkId })
await ae.awaitHeight(2)

Expand Down
4 changes: 2 additions & 2 deletions test/integration/oracle.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { describe, it, before } from 'mocha'
import { plan, ready } from './'
import { plan, getSdk } from './'
import { encodeBase64Check } from '../../es/utils/crypto'

plan('100000000000000000000')
Expand All @@ -28,7 +28,7 @@ describe('Oracle', function () {
const queryResponse = "{'tmp': 30}"

before(async function () {
client = await ready()
client = await getSdk()
})

it('Register Oracle with 5000 TTL', async () => {
Expand Down
6 changes: 3 additions & 3 deletions test/integration/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import { describe, it, before } from 'mocha'
import { encodeBase58Check, encodeBase64Check, generateKeyPair, salt } from '../../es/utils/crypto'
import { ready } from './index'
import { getSdk } from './index'
import { commitmentHash, isNameValid } from '../../es/tx/builder/helpers'
import { MemoryAccount } from '../../es'
import { AE_AMOUNT_FORMATS } from '../../es/utils/amount-formatter'
Expand Down Expand Up @@ -66,8 +66,8 @@ describe('Native Transaction', function () {

before(async () => {
const keyPair = generateKeyPair()
client = await ready(false)
clientNative = await ready()
client = await getSdk(false)
clientNative = await getSdk()
await client.spend('16774200000000000000', keyPair.publicKey)
await client.addAccount(MemoryAccount({ keypair: keyPair }), { select: true })
await clientNative.addAccount(MemoryAccount({ keypair: keyPair }), { select: true })
Expand Down
6 changes: 3 additions & 3 deletions test/integration/txVerification.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { before, describe, it } from 'mocha'
import { ready } from '.'
import { getSdk } from '.'
import { generateKeyPair } from '../../es/utils/crypto'
import { BASE_VERIFICATION_SCHEMA, SIGNATURE_VERIFICATION_SCHEMA } from '../../es/tx/builder/schema'
import MemoryAccount from '../../es/account/memory'
Expand All @@ -12,7 +12,7 @@ describe('Verify Transaction', function () {
let client

before(async () => {
client = await ready()
client = await getSdk()
await client.spend(1234, 'ak_LAqgfAAjAbpt4hhyrAfHyVg9xfVQWsk1kaHaii6fYXt6AJAGe')
})
it('validate params', async () => {
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('Verify Transaction', function () {
await checkErrors(signedTxFull)
})
it('verify transaction before broadcast', async () => {
client = await ready()
client = await getSdk()
const spendTx = await client.spendTx({
senderId: await client.address(),
recipientId: await client.address(),
Expand Down

0 comments on commit 59d33bf

Please sign in to comment.