From 6cdf2917c412432307e01cd91c3e93f29b95d650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renaud?= Date: Mon, 12 Feb 2024 17:48:56 +0100 Subject: [PATCH] fix hardhat plugin tests --- .../hardhat-project/hardhat.config.ts | 3 +++ packages/hardhat-plugin/test/index.test.ts | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/hardhat-plugin/test/fixture-projects/hardhat-project/hardhat.config.ts b/packages/hardhat-plugin/test/fixture-projects/hardhat-project/hardhat.config.ts index 7657c57730b..703918d9c94 100644 --- a/packages/hardhat-plugin/test/fixture-projects/hardhat-project/hardhat.config.ts +++ b/packages/hardhat-plugin/test/fixture-projects/hardhat-project/hardhat.config.ts @@ -23,6 +23,9 @@ const config: HardhatUserConfig = { endpoint: 'here goes a subgraph URI', }, }, + 1: { + unlockAddress: 'newAddress', + }, 12345: { name: 'New Network', id: 12345, diff --git a/packages/hardhat-plugin/test/index.test.ts b/packages/hardhat-plugin/test/index.test.ts index 4bb72e7b0e8..aaa8e9ef1a4 100644 --- a/packages/hardhat-plugin/test/index.test.ts +++ b/packages/hardhat-plugin/test/index.test.ts @@ -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' @@ -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() ) })