mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
move datatokens tests
This commit is contained in:
parent
67453da19d
commit
db693c7331
@ -1,6 +1,6 @@
|
||||
import { assert } from 'chai'
|
||||
import { TestContractHandler } from '../TestContractHandler'
|
||||
import { DataTokens } from '../../src/datatokens/Datatokens'
|
||||
import { TestContractHandler } from '../../TestContractHandler'
|
||||
import { DataTokens } from '../../../src/datatokens/Datatokens'
|
||||
|
||||
const Web3 = require('web3')
|
||||
const factory = require('@oceanprotocol/contracts/artifacts/development/Factory.json')
|
||||
@ -19,7 +19,7 @@ describe('DataTokens', () => {
|
||||
const blob = 'https://example.com/dataset-1'
|
||||
|
||||
describe('#test', () => {
|
||||
it('#deploy', async () => {
|
||||
it('should deploy contracts', async () => {
|
||||
contracts = new TestContractHandler(
|
||||
factory.abi,
|
||||
datatokensTemplate.abi,
|
||||
@ -32,7 +32,7 @@ describe('DataTokens', () => {
|
||||
await contracts.deployContracts(minter)
|
||||
})
|
||||
|
||||
it('#init', async () => {
|
||||
it('should initialize datatokens class', async () => {
|
||||
datatoken = new DataTokens(
|
||||
contracts.factoryAddress,
|
||||
factory.abi,
|
||||
@ -42,28 +42,28 @@ describe('DataTokens', () => {
|
||||
assert(datatoken !== null)
|
||||
})
|
||||
|
||||
it('#create', async () => {
|
||||
it('should create datatokens smart contract', async () => {
|
||||
tokenAddress = await datatoken.create(blob, minter)
|
||||
assert(tokenAddress !== null)
|
||||
})
|
||||
|
||||
it('#mint', async () => {
|
||||
it('should mint datatokens', async () => {
|
||||
await datatoken.mint(tokenAddress, minter, tokenAmount)
|
||||
balance = await datatoken.balance(tokenAddress, minter)
|
||||
assert(balance.toString() === tokenAmount.toString())
|
||||
})
|
||||
|
||||
it('#transfer', async () => {
|
||||
it('should transfer datatokens', async () => {
|
||||
await datatoken.transfer(tokenAddress, spender, tokenAmount, minter)
|
||||
balance = await datatoken.balance(tokenAddress, spender)
|
||||
assert(balance.toString() === tokenAmount.toString())
|
||||
})
|
||||
|
||||
it('#approve', async () => {
|
||||
it('should approve datatokens transfer', async () => {
|
||||
await datatoken.approve(tokenAddress, minter, tokenAmount, spender)
|
||||
})
|
||||
|
||||
it('#transferFrom', async () => {
|
||||
it('should transferFrom datatokens', async () => {
|
||||
await datatoken.transferFrom(tokenAddress, spender, tokenAmount, minter)
|
||||
balance = await datatoken.balance(tokenAddress, minter)
|
||||
assert(balance.toString() === tokenAmount.toString())
|
Loading…
x
Reference in New Issue
Block a user