[Solved] Using Multiple Initializers in Upgradable Smart Contract

Leon Africa Asks: Using Multiple Initializers in Upgradable Smart Contract
For Upgradable Smart contract following pattern as specified here:

Writing Upgradeable Contracts – OpenZeppelin Docs

“Constructor”/Initializer has form:

Code:
function initialize() public initializer {
       .......
       .......
       .......
    }

Now suppose I have a set of initial value field declarations and I set them in a separate initializer – say:

Code:
function initializeInitialValues() public initializer {
       .......
       .......
       .......
    }

The code below does not pick up the initializers

Code:
let MyContract;
let mycontract;

describe("MyContract", function() {

  beforeEach(async function () {
     MyContract= await ethers.getContractFactory("MyContract");
     mycontract= await upgrades.deployProxy(MyContract, {initializer: 'initialize', initializer: initializeInitialValues()});
  });
       .......
       .......
       .......

});

Using only await upgrades.deployProxy(MyContract, {initializer: 'initialize'} and putting all values in there works. i.e

Code:
function initialize() public initializer {
       constructor values
              &
       initial value field declarations
    }

When deploying/testing the smart contract how do I specify multiple initializers?

Especially as a means to logically separate unrelated components in the upgradable smart contract. i.e. constructor values vs initial value field declarations

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.