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:
parent
e4a8a83674
commit
eda9501010
@ -16,22 +16,23 @@ describe('FixedRateExchange flow', () => {
|
|||||||
let oceanTokenAddress
|
let oceanTokenAddress
|
||||||
let FixedRateExchangeAddress
|
let FixedRateExchangeAddress
|
||||||
let FixedRateClass
|
let FixedRateClass
|
||||||
let oceandatatoken
|
let oceandatatoken: DataTokens
|
||||||
let aliceExchangeId
|
let aliceExchangeId
|
||||||
let bob
|
let bob: string
|
||||||
let alice
|
let alice: string
|
||||||
let datatoken
|
let datatoken: DataTokens
|
||||||
let tokenAddress
|
let tokenAddress
|
||||||
|
|
||||||
let owner
|
let owner
|
||||||
let contracts
|
let contracts: TestContractHandler
|
||||||
|
|
||||||
const consoleDebug = false
|
const consoleDebug = false
|
||||||
const tokenAmount = '1000000000000000000000000000000000'
|
const tokenAmount = '1000'
|
||||||
const fixedPriceRate = '0.5'
|
const fixedPriceRate = '0.5'
|
||||||
const updatedPriceRate = '2'
|
const updatedPriceRate = '2'
|
||||||
const swapAmount = '1'
|
const swapAmount = '1'
|
||||||
const blob = 'http://localhost:8030/api/v1/services/consume'
|
const blob = 'http://localhost:8030/api/v1/services/consume'
|
||||||
|
|
||||||
describe('#test', () => {
|
describe('#test', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
// deploy SFactory
|
// deploy SFactory
|
||||||
@ -125,10 +126,12 @@ describe('FixedRateExchange flow', () => {
|
|||||||
it('Alice should have 1000 tokens', async () => {
|
it('Alice should have 1000 tokens', async () => {
|
||||||
const balance = await datatoken.balance(tokenAddress, alice)
|
const balance = await datatoken.balance(tokenAddress, alice)
|
||||||
if (consoleDebug) console.log("Alice's datatoke balance:" + balance)
|
if (consoleDebug) console.log("Alice's datatoke balance:" + balance)
|
||||||
|
assert(balance === tokenAmount)
|
||||||
})
|
})
|
||||||
it('Bob should have 1000 ocean tokens', async () => {
|
it('Bob should have 1000 ocean tokens', async () => {
|
||||||
const balance = await oceandatatoken.balance(oceanTokenAddress, bob)
|
const balance = await oceandatatoken.balance(oceanTokenAddress, bob)
|
||||||
if (consoleDebug) console.log("Bob's ocean balance:" + balance)
|
if (consoleDebug) console.log("Bob's ocean balance:" + balance)
|
||||||
|
assert(balance === tokenAmount)
|
||||||
})
|
})
|
||||||
it('Alice allows Exchange to spend 1000 data tokens', async () => {
|
it('Alice allows Exchange to spend 1000 data tokens', async () => {
|
||||||
const txid = await datatoken.approve(
|
const txid = await datatoken.approve(
|
||||||
|
@ -15,26 +15,19 @@ describe('Ocean', () => {
|
|||||||
// ocean = await Ocean.getInstance(config)
|
// ocean = await Ocean.getInstance(config)
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
// spy.on(ocean.utils.signature, 'signText', () => `0x${'a'.repeat(130)}`)
|
|
||||||
})
|
|
||||||
afterEach(() => {
|
|
||||||
// spy.restore()
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('#getInstance()', () => {
|
describe('#getInstance()', () => {
|
||||||
it('should get an instance of Ocean', async () => {
|
it('should get an instance of Ocean', async () => {
|
||||||
// const oceanInstance: Ocean = await Ocean.getInstance(config)
|
const oceanInstance: Ocean = await Ocean.getInstance(config)
|
||||||
// assert(oceanInstance)
|
assert(oceanInstance)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('#getAccounts()', () => {
|
describe('#getAccounts()', () => {
|
||||||
it('should list accounts', async () => {
|
// it('should list accounts', async () => {
|
||||||
// const accs: Account[] = await ocean.accounts.list()
|
// const accs: Account[] = await ocean.accounts.list()
|
||||||
// assert(accs.length === 10)
|
// assert(accs.length === 10)
|
||||||
// assert((await accs[5].getBalance()).ocn === 0)
|
// assert((await accs[5].getOceanBalance()) === '0')
|
||||||
// assert(typeof accs[0].getId() === 'string')
|
// assert(typeof accs[0].getId() === 'string')
|
||||||
})
|
// })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user