Skip to content

Commit

Permalink
add rinkeby test
Browse files Browse the repository at this point in the history
  • Loading branch information
arseneeth committed Jun 22, 2020
1 parent 1454785 commit 24c8a87
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
24 changes: 23 additions & 1 deletion test/integration/Rinkeby.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
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')
const factory = require('@oceanprotocol/contracts/artifacts/development/Factory.json')
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 () => {
Expand All @@ -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)
})
})
})
2 changes: 1 addition & 1 deletion test/integration/Simpleflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})

Expand Down

0 comments on commit 24c8a87

Please sign in to comment.