1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

add simpleflow structure

This commit is contained in:
arsenyjin 2020-06-16 14:39:21 +02:00
parent 13fe64395a
commit b8f2092f74

View File

@ -13,14 +13,14 @@ describe('Simple flow', () => {
let owner let owner
let alice let alice
let bob let bob
let marketplace
let balance let balance
let contracts let contracts
let datatoken let datatoken
let tokenAddress let tokenAddress
let tokenAmount = 100 let tokenAmount = 100
let blob = 'https://example.com/dataset-1' let transferAmount = 1
let blob = 'localhost:8030/api/v1/services'
describe('#test', () => { describe('#test', () => {
it('Initialize Ocean contracts v3', async () => { it('Initialize Ocean contracts v3', async () => {
@ -29,7 +29,6 @@ describe('Simple flow', () => {
owner = contracts.accounts[0] owner = contracts.accounts[0]
alice = contracts.accounts[1] alice = contracts.accounts[1]
bob = contracts.accounts[2] bob = contracts.accounts[2]
marketplace = contracts.accounts[3]
await contracts.deployContracts(owner) await contracts.deployContracts(owner)
}) })
@ -39,12 +38,21 @@ describe('Simple flow', () => {
network: 'ganache', network: 'ganache',
providerUri: 'localhost:8030' providerUri: 'localhost:8030'
} }
// Alice creates a Datatoken
datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3) datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3)
tokenAddress = await datatoken.create(config.providerUri, alice) tokenAddress = await datatoken.create(config.providerUri, alice)
})
//Alice allows MarketPlace to transfer tokenAmount of DT it('Alice mints 100 tokens', async () => {
await datatoken.approve(tokenAddress, alice, tokenAmount, marketplace) datatoken.mint(tokenAddress, alice, tokenAmount)
})
it('Alice transfers 1 token to Bob', async () => {
datatoken.transfer(tokenAddress, bob, tokenAmount, alice)
})
it('Bob consumes dataset', async () => {
datatoken.transfer(tokenAddress, bob, tokenAmount, alice)
}) })
}) })
}) })