From 24c8a87623f70ea96b6ebd0e5677011241281960 Mon Sep 17 00:00:00 2001 From: arsenyjin Date: Mon, 22 Jun 2020 09:38:43 +0200 Subject: [PATCH] add rinkeby test --- test/integration/Rinkeby.test.ts | 24 +++++++++++++++++++++++- test/integration/Simpleflow.test.ts | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/test/integration/Rinkeby.test.ts b/test/integration/Rinkeby.test.ts index 38fef0f79..e8abacbbd 100644 --- a/test/integration/Rinkeby.test.ts +++ b/test/integration/Rinkeby.test.ts @@ -1,4 +1,5 @@ import { TestContractHandler } from '../TestContractHandler' +import { DataTokens } from '../../src/datatokens/Datatokens' const Web3 = require('web3') const web3 = new Web3('wss://rinkeby.infura.io/ws/v3/357f2fe737db4304bd2f7285c5602d0d') @@ -6,7 +7,14 @@ const factory = require('@oceanprotocol/contracts/artifacts/development/Factory. const datatokensTemplate = require('@oceanprotocol/contracts/artifacts/development/DataTokenTemplate.json') describe('Rinkeby test', () => { + let account let contracts + let datatoken + let tokenAddress + + const tokenAmount = 100 + const blob = 'http://localhost:8030/api/v1/provider/services' + describe('#test', () => { it('Initialize Ocean contracts v3', async () => { @@ -19,11 +27,25 @@ describe('Rinkeby test', () => { ) const privateKey = 'PRIVATE_KEY' - const account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey) + account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey) web3.eth.accounts.wallet.add(account) await contracts.deployContracts(account.address) }) + it('Publish a dataset', async () => { + datatoken = new DataTokens( + contracts.factoryAddress, + factory.abi, + datatokensTemplate.abi, + web3 + ) + + tokenAddress = await datatoken.create(blob, account.address) + }) + + it('Mint 100 tokens', async () => { + await datatoken.mint(tokenAddress, account.address, tokenAmount) + }) }) }) \ No newline at end of file diff --git a/test/integration/Simpleflow.test.ts b/test/integration/Simpleflow.test.ts index 1dd54e394..93fbcb81a 100644 --- a/test/integration/Simpleflow.test.ts +++ b/test/integration/Simpleflow.test.ts @@ -53,7 +53,7 @@ describe('Simple flow', () => { }) it('Alice transfers 1 token to Bob', async () => { - const ts = await datatoken.transfer(tokenAddress, bob, tokenAmount, alice) + const ts = await datatoken.transfer(tokenAddress, bob, transferAmount, alice) transactionId = ts.transactionHash })