ocean-subgraph/test/integration/ZEnding.test.ts
Alex Coseru 2a711626ed
add integration tests (#74)
* add integration tests

* try actions

* workflows check

* workflows testing

* workflow test

* workflow test

* workflow test

* increase timeout

* small fix

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* workflow test

* workflow test

* workflow test

* fix workflows

* add readme

* fix readme

* one more test

* end test

Co-authored-by: mihaisc <mihai.scarlat@smartcontrol.ro>
2021-04-13 18:10:03 +03:00

38 lines
1018 B
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'
use(spies)
describe('Ending tests', () => {
let result: any
it('Get Graph status', async () => {
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 sync errors', async () => {
assert(result.data._meta.hasIndexingErrors == false)
})
it('Make sure that graph has synced to last block', async () => {
const lastblock = await web3.eth.getBlockNumber()
assert(result.data._meta.block.number === lastblock)
})
})