ocean-subgraph/test/integration/ZEnding.test.ts
Alex Coseru fe68442fe2
Feature/more ve (#543)
* link deposits to veOcean

* add FeeDistributor, claims & checkpoints

* fix lint

* link claims to VeOcean

* fix handleCheckpoint

* add comments & fix bug

* link veAllocationUser to veOcean (#537)

* advance chain

* fix veOcean withdraw

* bump contracts to 1.1.7

* fix test
2022-09-23 15:54:27 +03:00

46 lines
1.2 KiB
TypeScript

/* eslint-disable prefer-destructuring */
import { assert, use } from 'chai'
import spies from 'chai-spies'
import Web3 from 'web3'
const fetch = require('cross-fetch')
const web3 = new Web3('http://127.0.0.1:8545')
const subgraphUrl =
'http://localhost:9000/subgraphs/name/oceanprotocol/ocean-subgraph'
function sleep(ms: number) {
return new Promise((resolve) => {
setTimeout(resolve, ms)
})
}
use(spies)
describe('Ending tests', () => {
let result: any
let lastblock
it('Get Graph status', async () => {
lastblock = await web3.eth.getBlockNumber()
await sleep(3000) // let graph ingest our last transactions
const query = {
query: `query {
_meta{hasIndexingErrors,
deployment,
block{number}
}
}`
}
const response = await fetch(subgraphUrl, {
method: 'POST',
body: JSON.stringify(query)
})
result = await response.json()
})
it('Make sure that graph has no index errors', async () => {
assert(result.data._meta.hasIndexingErrors == false)
})
it('Make sure that graph has synced to last block', async () => {
assert(result.data._meta.block.number >= lastblock)
})
})