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

test fixes

This commit is contained in:
Matthias Kretschmann 2020-09-03 13:23:14 +02:00
parent e4a8a83674
commit eda9501010
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 17 additions and 21 deletions

View File

@ -16,22 +16,23 @@ describe('FixedRateExchange flow', () => {
let oceanTokenAddress
let FixedRateExchangeAddress
let FixedRateClass
let oceandatatoken
let oceandatatoken: DataTokens
let aliceExchangeId
let bob
let alice
let datatoken
let bob: string
let alice: string
let datatoken: DataTokens
let tokenAddress
let owner
let contracts
let contracts: TestContractHandler
const consoleDebug = false
const tokenAmount = '1000000000000000000000000000000000'
const tokenAmount = '1000'
const fixedPriceRate = '0.5'
const updatedPriceRate = '2'
const swapAmount = '1'
const blob = 'http://localhost:8030/api/v1/services/consume'
describe('#test', () => {
before(async () => {
// deploy SFactory
@ -125,10 +126,12 @@ describe('FixedRateExchange flow', () => {
it('Alice should have 1000 tokens', async () => {
const balance = await datatoken.balance(tokenAddress, alice)
if (consoleDebug) console.log("Alice's datatoke balance:" + balance)
assert(balance === tokenAmount)
})
it('Bob should have 1000 ocean tokens', async () => {
const balance = await oceandatatoken.balance(oceanTokenAddress, bob)
if (consoleDebug) console.log("Bob's ocean balance:" + balance)
assert(balance === tokenAmount)
})
it('Alice allows Exchange to spend 1000 data tokens', async () => {
const txid = await datatoken.approve(

View File

@ -15,26 +15,19 @@ describe('Ocean', () => {
// ocean = await Ocean.getInstance(config)
})
beforeEach(async () => {
// spy.on(ocean.utils.signature, 'signText', () => `0x${'a'.repeat(130)}`)
})
afterEach(() => {
// spy.restore()
})
describe('#getInstance()', () => {
it('should get an instance of Ocean', async () => {
// const oceanInstance: Ocean = await Ocean.getInstance(config)
// assert(oceanInstance)
const oceanInstance: Ocean = await Ocean.getInstance(config)
assert(oceanInstance)
})
})
describe('#getAccounts()', () => {
it('should list accounts', async () => {
// const accs: Account[] = await ocean.accounts.list()
// assert(accs.length === 10)
// assert((await accs[5].getBalance()).ocn === 0)
// assert(typeof accs[0].getId() === 'string')
})
// it('should list accounts', async () => {
// const accs: Account[] = await ocean.accounts.list()
// assert(accs.length === 10)
// assert((await accs[5].getOceanBalance()) === '0')
// assert(typeof accs[0].getId() === 'string')
// })
})
})