-
Notifications
You must be signed in to change notification settings - Fork 157
/
Copy pathgre.test.ts
53 lines (44 loc) · 1.62 KB
/
gre.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import path from 'path'
import { assert, expect } from 'chai'
import { loadHardhatContext, useHardhatProject } from './helpers'
import { GraphHorizonAddressBook } from '@graphprotocol/toolshed/deployments'
describe('GRE usage', function () {
describe('Project not using GRE', function () {
useHardhatProject('default-config', 'mainnet')
it('should throw when accessing hre.graph()', function () {
expect(() => this.hre.graph()).to.throw()
})
})
describe(`Project using GRE - graph path`, function () {
it('should add the graph path to the config', function () {
this.hre = loadHardhatContext('no-path-config', 'mainnet')
assert.equal(
this.hre.config.paths.graph,
path.join(__dirname, 'fixtures/no-path-config'),
)
})
it('should add the graph path to the config from custom path', function () {
this.hre = loadHardhatContext('path-config', 'mainnet')
assert.equal(
this.hre.config.paths.graph,
path.join(__dirname, 'fixtures/files'),
)
})
})
describe(`Project using GRE - deployments`, function () {
useHardhatProject('path-config', 'arbitrumSepolia')
it('should load Horizon deployment', function () {
const graph = this.hre.graph()
assert.isDefined(graph.horizon)
assert.isObject(graph.horizon)
assert.isDefined(graph.horizon.contracts)
assert.isObject(graph.horizon.contracts)
assert.isDefined(graph.horizon.addressBook)
assert.isObject(graph.horizon.addressBook)
assert.instanceOf(
graph.horizon.addressBook,
GraphHorizonAddressBook,
)
})
})
})