mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
test tweaks
This commit is contained in:
parent
6f85014e00
commit
455983f7b6
@ -26,10 +26,8 @@ before_script:
|
||||
- sleep 300
|
||||
|
||||
script:
|
||||
- npm run lint
|
||||
- npm test
|
||||
- npm run build
|
||||
- npm run test:unit:cover
|
||||
- npm run test:integration:cover
|
||||
|
||||
after_script:
|
||||
- ./cc-test-reporter format-coverage -t lcov -o coverage/codeclimate.unit.json coverage/unit/lcov.info # Format unit test coverage
|
||||
|
@ -24,7 +24,7 @@
|
||||
"test:unit": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/**/*.test.ts'",
|
||||
"test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit",
|
||||
"test:integration": "mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/**/*.test.ts'",
|
||||
"test:integration:cover": "nyc --report-dir coverage/integration npm run test:integration"
|
||||
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -26,8 +26,9 @@ export class BalancerContractHandler {
|
||||
this.poolBytecode = poolBytecode
|
||||
}
|
||||
|
||||
public async getAccounts() {
|
||||
public async getAccounts(): Promise<string[]> {
|
||||
this.accounts = await this.web3.eth.getAccounts()
|
||||
return this.accounts
|
||||
}
|
||||
|
||||
public async deployContracts(minter: string) {
|
||||
|
@ -1,7 +1,9 @@
|
||||
import Web3 from 'web3'
|
||||
import { Contract } from 'web3-eth-contract'
|
||||
import { AbiItem } from 'web3-utils/types'
|
||||
|
||||
const communityCollector = '0xeE9300b7961e0a01d9f0adb863C7A227A07AaD75'
|
||||
|
||||
export class TestContractHandler {
|
||||
public factory: Contract
|
||||
public template: Contract
|
||||
@ -26,8 +28,9 @@ export class TestContractHandler {
|
||||
this.factoryBytecode = factoryBytecode
|
||||
}
|
||||
|
||||
public async getAccounts() {
|
||||
public async getAccounts(): Promise<string[]> {
|
||||
this.accounts = await this.web3.eth.getAccounts()
|
||||
return this.accounts
|
||||
}
|
||||
|
||||
public async deployContracts(minter: string) {
|
||||
|
@ -53,7 +53,6 @@ describe('Compute flow', () => {
|
||||
}
|
||||
}
|
||||
|
||||
describe('#MarketplaceComputeFlow-Test', () => {
|
||||
it('Initialize Ocean contracts v3', async () => {
|
||||
contracts = new TestContractHandler(
|
||||
factory.abi as AbiItem[],
|
||||
@ -114,10 +113,7 @@ describe('Compute flow', () => {
|
||||
|
||||
it('Alice publishes dataset with a compute service that allows Raw Algo', async () => {
|
||||
price = datatoken.toWei('2') // in datatoken
|
||||
cluster = ocean.compute.createClusterAttributes(
|
||||
'Kubernetes',
|
||||
'http://10.0.0.17/xxx'
|
||||
)
|
||||
cluster = ocean.compute.createClusterAttributes('Kubernetes', 'http://10.0.0.17/xxx')
|
||||
servers = [
|
||||
ocean.compute.createServerAttributes(
|
||||
'1',
|
||||
@ -241,12 +237,7 @@ describe('Compute flow', () => {
|
||||
dateCreated,
|
||||
0
|
||||
)
|
||||
algorithmAsset = await ocean.assets.create(
|
||||
algoAsset,
|
||||
alice,
|
||||
[service1],
|
||||
tokenAddress
|
||||
)
|
||||
algorithmAsset = await ocean.assets.create(algoAsset, alice, [service1], tokenAddress)
|
||||
assert(algorithmAsset.dataToken === tokenAddress)
|
||||
})
|
||||
|
||||
@ -389,4 +380,3 @@ describe('Compute flow', () => {
|
||||
// it('Bob restarts compute job', async () => {})
|
||||
// it('Bob gets outputs', async () => {})
|
||||
})
|
||||
})
|
||||
|
@ -30,7 +30,6 @@ describe('Marketplace flow', () => {
|
||||
const marketplaceAllowance = '20'
|
||||
const tokenAmount = '100'
|
||||
|
||||
describe('#MarketplaceDownloadFlow-Test', () => {
|
||||
it('Initialize Ocean contracts v3', async () => {
|
||||
contracts = new TestContractHandler(
|
||||
factory.abi as AbiItem[],
|
||||
@ -186,4 +185,3 @@ describe('Marketplace flow', () => {
|
||||
assert(assets.length > 0)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -1,43 +0,0 @@
|
||||
import { TestContractHandler } from '../TestContractHandler'
|
||||
import { DataTokens } from '../../src/datatokens/Datatokens'
|
||||
|
||||
import Web3 from 'web3'
|
||||
import factory from '@oceanprotocol/contracts/artifacts/DTFactory.json'
|
||||
import datatokensTemplate from '@oceanprotocol/contracts/artifacts/DataTokenTemplate.json'
|
||||
const web3 = new Web3('wss://rinkeby.infura.io/ws/v3/357f2fe737db4304bd2f7285c5602d0d')
|
||||
|
||||
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 () => {
|
||||
// contracts = new TestContractHandler(
|
||||
// factory.abi,
|
||||
// datatokensTemplate.abi,
|
||||
// datatokensTemplate.bytecode,
|
||||
// factory.bytecode,
|
||||
// web3
|
||||
// )
|
||||
// const privateKey = 'PRIVATE_KEY'
|
||||
// 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)
|
||||
// })
|
||||
// })
|
||||
})
|
@ -18,7 +18,7 @@ describe('Simple flow', () => {
|
||||
const tokenAmount = '100'
|
||||
const transferAmount = '1'
|
||||
const blob = 'http://localhost:8030/api/v1/services/consume'
|
||||
describe('#test', () => {
|
||||
|
||||
it('Initialize Ocean contracts v3', async () => {
|
||||
contracts = new TestContractHandler(
|
||||
factory.abi as AbiItem[],
|
||||
@ -56,4 +56,3 @@ describe('Simple flow', () => {
|
||||
// await ocean.assets.simpleDownload(tokenAddress, blob, transactionId, bob)
|
||||
// })
|
||||
})
|
||||
})
|
||||
|
@ -19,7 +19,6 @@ describe('DataTokens', () => {
|
||||
const tokenAmount = '100'
|
||||
const blob = 'https://example.com/dataset-1'
|
||||
|
||||
describe('#test', () => {
|
||||
it('should deploy contracts', async () => {
|
||||
contracts = new TestContractHandler(
|
||||
factory.abi as AbiItem[],
|
||||
@ -81,4 +80,3 @@ describe('DataTokens', () => {
|
||||
assert(balance === tokenAmount)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -155,7 +155,7 @@ describe('Balancer flow', () => {
|
||||
|
||||
it('Get dtPrice from the pool ', async () => {
|
||||
currentDtPrice = await Pool.getDTPrice(alice, alicePoolAddress)
|
||||
assert(currentDtPrice > 0)
|
||||
assert(Number(currentDtPrice) > 0)
|
||||
})
|
||||
it('Get dtToken pool reserve ', async () => {
|
||||
const currentDtReserve = await Pool.getDTReserve(alice, alicePoolAddress)
|
||||
|
@ -23,7 +23,7 @@ describe('FixedRateExchange flow', () => {
|
||||
let datatoken: DataTokens
|
||||
let tokenAddress: string
|
||||
|
||||
let owner
|
||||
let owner: string
|
||||
let contracts: TestContractHandler
|
||||
|
||||
const consoleDebug = false
|
||||
@ -33,7 +33,6 @@ describe('FixedRateExchange flow', () => {
|
||||
const swapAmount = '1'
|
||||
const blob = 'http://localhost:8030/api/v1/services/consume'
|
||||
|
||||
describe('#test', () => {
|
||||
before(async () => {
|
||||
// deploy SFactory
|
||||
const Contracts = new FixedPricedContractHandler(
|
||||
@ -181,10 +180,7 @@ describe('FixedRateExchange flow', () => {
|
||||
})
|
||||
|
||||
it('Bob should get the amount of Ocean needed', async () => {
|
||||
const OceansNeeded = await FixedRateClass.CalcInGivenOut(
|
||||
aliceExchangeId,
|
||||
swapAmount
|
||||
)
|
||||
const OceansNeeded = await FixedRateClass.CalcInGivenOut(aliceExchangeId, swapAmount)
|
||||
if (consoleDebug) console.log('Oceans needed:' + OceansNeeded)
|
||||
assert(OceansNeeded !== null)
|
||||
})
|
||||
@ -226,4 +222,3 @@ describe('FixedRateExchange flow', () => {
|
||||
assert(exchangeDetails.active === true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user