mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { assert } from 'chai'
|
|
import { TestContractHandler } from '../TestContractHandler'
|
|
import { DataTokens } from '../../src/datatokens/Datatokens'
|
|
|
|
const Web3 = require('web3')
|
|
const web3 = new Web3("http://127.0.0.1:8545")
|
|
|
|
const factoryABI = require('../../src/datatokens/FactoryABI.json')
|
|
const datatokensABI = require('../../src/datatokens/DatatokensABI.json')
|
|
|
|
describe('Simple flow', () => {
|
|
|
|
let minter
|
|
let spender
|
|
let balance
|
|
let contracts
|
|
let datatoken
|
|
let tokenAddress
|
|
|
|
let tokenAmount = 100
|
|
let blob = 'https://example.com/dataset-1'
|
|
|
|
describe('#test', () => {
|
|
it('should deploy contracts', async () => {
|
|
contracts = new TestContractHandler(factoryABI,datatokensABI)
|
|
await contracts.getAccounts()
|
|
minter = contracts.accounts[0]
|
|
spender = contracts.accounts[1]
|
|
await contracts.deployContracts(minter)
|
|
})
|
|
|
|
it('should create Datatoken object', async () => {
|
|
datatoken = new DataTokens(contracts.factoryAddress, factoryABI, datatokensABI, web3)
|
|
assert(datatoken !== null)
|
|
})
|
|
|
|
it('should create Datatoken contract', async () => {
|
|
tokenAddress = await datatoken.create(blob, minter)
|
|
assert(tokenAddress !== null)
|
|
})
|
|
|
|
})
|
|
}) |