From 5f292b1af5f1e81b16e3adc8ebb637b3b2ff5456 Mon Sep 17 00:00:00 2001 From: Lawrence Wang Date: Mon, 2 Dec 2019 11:57:32 -0800 Subject: [PATCH] add test for smartContract.addressOverrides and plugins --- packages/dai/test/Maker.spec.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/dai/test/Maker.spec.js b/packages/dai/test/Maker.spec.js index b3d00011e..785e9229d 100644 --- a/packages/dai/test/Maker.spec.js +++ b/packages/dai/test/Maker.spec.js @@ -78,3 +78,27 @@ test('injected provider is called', async () => { expect(mockSend).toBeCalled(); }); + +test('smartContract.addressOverrides can override plugins', async () => { + const maker = await Maker.create('test', { + plugins: [ + { + addConfig: () => ({ + smartContract: { + addContracts: { + FOO: { address: '0xfoo', abi: [] } + } + } + }) + } + ], + smartContract: { + addressOverrides: { FOO: '0xfoo2' } + }, + log: false + }); + + // addressOverrides should be able to modify contracts added by plugins + const addresses = maker.service('smartContract').getContractAddresses(); + expect(addresses.FOO).toEqual('0xfoo2'); +});