Skip to content

Commit

Permalink
Refactor integration/index
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Jun 21, 2020
1 parent fad90a6 commit 4aa7f1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion test/integration/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe('Contract', function () {
let deployed

before(async function () {
contract = await ready(this, true, true)
contract = await ready(this, true)
})
describe('Aens and Oracle operation delegation', () => {
let cInstance
Expand Down
28 changes: 7 additions & 21 deletions test/integration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@
* PERFORMANCE OF THIS SOFTWARE.
*/

import { Universal as Ae } from '../../es/ae/universal'
import * as Crypto from '../../es/utils/crypto'
import { Universal, Crypto, MemoryAccount, Node } from '../../es'
import { BigNumber } from 'bignumber.js'
import MemoryAccount from '../../es/account/memory'
import Node from '../../es/node'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'

chai.use(chaiAsPromised)
chai.should()

export const url = process.env.TEST_URL || 'http://localhost:3013'
export const internalUrl = process.env.TEST_INTERNAL_URL || 'http://localhost:3113'
export const compilerUrl = process.env.COMPILER_URL || 'http://localhost:3080'
export const networkId = process.env.TEST_NETWORK_ID || 'ae_devnet'
export const forceCompatibility = process.env.FORCE_COMPATIBILITY || false
const forceCompatibility = process.env.FORCE_COMPATIBILITY || false
export const account = Crypto.generateKeyPair()

export const BaseAe = async (params) => Ae.waitMined(true).compose({
export const BaseAe = async (params) => Universal.waitMined(true).compose({
deepProps: { Swagger: { defaults: { debug: !!process.env['DEBUG'] } } },
props: { process, compilerUrl }
})({
Expand All @@ -48,13 +46,11 @@ export function plan (amount) {
planned = planned.plus(amount)
}

export const TIMEOUT = 18000000

export function configure (mocha) {
mocha.timeout(TIMEOUT)
mocha.timeout(18000000)
}

export async function ready (mocha, native = true, withAccounts = false) {
export async function ready (mocha, nativeMode = true) {
configure(mocha)

const ae = await BaseAe({ networkId })
Expand All @@ -69,17 +65,7 @@ export async function ready (mocha, native = true, withAccounts = false) {
return BaseAe({
accounts: [MemoryAccount({ keypair: account })],
address: account.publicKey,
nativeMode: native,
nativeMode,
networkId
})
}

export default {
BaseAe,
url,
internalUrl,
networkId,
configure,
ready,
plan,
}

0 comments on commit 4aa7f1f

Please sign in to comment.