Skip to content

Commit

Permalink
fix hardhat plugin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
clemsos committed Feb 12, 2024
1 parent 4e3e669 commit 6cdf291
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Expand Up @@ -23,6 +23,9 @@ const config: HardhatUserConfig = {
endpoint: 'here goes a subgraph URI',
},
},
1: {
unlockAddress: 'newAddress',
},
12345: {
name: 'New Network',
id: 12345,
Expand Down
11 changes: 8 additions & 3 deletions packages/hardhat-plugin/test/index.test.ts
Expand Up @@ -34,13 +34,18 @@ describe('Unlock Hardhat plugin', function () {
assert.instanceOf(this.hre.unlock, Object)
})

it('should store networks info', function () {
it('should store and extend existing networks info', function () {
assert.isTrue(Object.keys(this.hre.unlock.networks).includes('1'))
assert.equal(this.hre.unlock.networks['1'].name, networks['1'].name)
assert.equal(this.hre.unlock.networks['1'].id, networks['1'].id)
assert.equal(this.hre.unlock.networks['1'].unlockAddress, 'newAddress')
})
it('should store additional networks info', function () {
assert.isTrue(Object.keys(this.hre.unlock.networks).includes('31337'))
assert.equal(
this.hre.unlock.networks['31337'].name,
'Custom Localhost Name'
)
assert.equal(this.hre.unlock.networks['31337'].id, networks['31337'].id)
assert.equal(
this.hre.unlock.networks['31337'].subgraph?.endpoint,
'here goes a subgraph URI'
Expand Down Expand Up @@ -213,7 +218,7 @@ describe('HardhatConfig unlock extension', function () {
assert.isTrue(Object.keys(this.hre.config).includes('unlock'))
assert.deepEqual(
Object.keys(this.hre.config.unlock).sort(),
[...Object.keys(networks), '12345'].sort()
[...Object.keys(networks), '12345', '31337'].sort()
)
})

Expand Down

0 comments on commit 6cdf291

Please sign in to comment.