TransparentUpgradeableProxy.test.js 989 B

12345678910111213141516171819202122232425262728
  1. const { ethers } = require('hardhat');
  2. const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
  3. const shouldBehaveLikeProxy = require('../Proxy.behaviour');
  4. const shouldBehaveLikeTransparentUpgradeableProxy = require('./TransparentUpgradeableProxy.behaviour');
  5. async function fixture() {
  6. const [owner, other, ...accounts] = await ethers.getSigners();
  7. const implementation = await ethers.deployContract('DummyImplementation');
  8. const createProxy = function (logic, initData, opts = undefined) {
  9. return ethers.deployContract('TransparentUpgradeableProxy', [logic, owner, initData], opts);
  10. };
  11. return { nonContractAddress: owner, owner, other, accounts, implementation, createProxy };
  12. }
  13. describe('TransparentUpgradeableProxy', function () {
  14. beforeEach(async function () {
  15. Object.assign(this, await loadFixture(fixture));
  16. });
  17. shouldBehaveLikeProxy();
  18. // createProxy, owner, otherAccounts
  19. shouldBehaveLikeTransparentUpgradeableProxy();
  20. });