From eda950101056ae4fdfc76235ad24fa397ab7d219 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 3 Sep 2020 13:23:14 +0200 Subject: [PATCH] test fixes --- .../unit/exchanges/FixedPriceExchange.test.ts | 15 +++++++----- test/unit/ocean/Ocean.test.ts | 23 +++++++------------ 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/test/unit/exchanges/FixedPriceExchange.test.ts b/test/unit/exchanges/FixedPriceExchange.test.ts index ed59e32b..3c02e88f 100644 --- a/test/unit/exchanges/FixedPriceExchange.test.ts +++ b/test/unit/exchanges/FixedPriceExchange.test.ts @@ -16,22 +16,23 @@ describe('FixedRateExchange flow', () => { let oceanTokenAddress let FixedRateExchangeAddress let FixedRateClass - let oceandatatoken + let oceandatatoken: DataTokens let aliceExchangeId - let bob - let alice - let datatoken + let bob: string + let alice: string + let datatoken: DataTokens let tokenAddress let owner - let contracts + let contracts: TestContractHandler const consoleDebug = false - const tokenAmount = '1000000000000000000000000000000000' + const tokenAmount = '1000' const fixedPriceRate = '0.5' const updatedPriceRate = '2' const swapAmount = '1' const blob = 'http://localhost:8030/api/v1/services/consume' + describe('#test', () => { before(async () => { // deploy SFactory @@ -125,10 +126,12 @@ describe('FixedRateExchange flow', () => { it('Alice should have 1000 tokens', async () => { const balance = await datatoken.balance(tokenAddress, alice) if (consoleDebug) console.log("Alice's datatoke balance:" + balance) + assert(balance === tokenAmount) }) it('Bob should have 1000 ocean tokens', async () => { const balance = await oceandatatoken.balance(oceanTokenAddress, bob) if (consoleDebug) console.log("Bob's ocean balance:" + balance) + assert(balance === tokenAmount) }) it('Alice allows Exchange to spend 1000 data tokens', async () => { const txid = await datatoken.approve( diff --git a/test/unit/ocean/Ocean.test.ts b/test/unit/ocean/Ocean.test.ts index 7896759a..1207d541 100644 --- a/test/unit/ocean/Ocean.test.ts +++ b/test/unit/ocean/Ocean.test.ts @@ -15,26 +15,19 @@ describe('Ocean', () => { // ocean = await Ocean.getInstance(config) }) - beforeEach(async () => { - // spy.on(ocean.utils.signature, 'signText', () => `0x${'a'.repeat(130)}`) - }) - afterEach(() => { - // spy.restore() - }) - describe('#getInstance()', () => { it('should get an instance of Ocean', async () => { - // const oceanInstance: Ocean = await Ocean.getInstance(config) - // assert(oceanInstance) + const oceanInstance: Ocean = await Ocean.getInstance(config) + assert(oceanInstance) }) }) describe('#getAccounts()', () => { - it('should list accounts', async () => { - // const accs: Account[] = await ocean.accounts.list() - // assert(accs.length === 10) - // assert((await accs[5].getBalance()).ocn === 0) - // assert(typeof accs[0].getId() === 'string') - }) + // it('should list accounts', async () => { + // const accs: Account[] = await ocean.accounts.list() + // assert(accs.length === 10) + // assert((await accs[5].getOceanBalance()) === '0') + // assert(typeof accs[0].getId() === 'string') + // }) }) })