How to test methods with the same name but different parameters

Hi @taelimoh,

Welcome to the community :wave:

It is possible to test overloaded functions by using [contract].methods['functionSignature']

As an example we can send a transaction to the following function

transfer(address recipient, uint256 amount, uint256 x, uint256 y) public virtual returns (bool)

Using:

await this.token.methods['transfer(address,uint256,uint256,uint256)'](other, amount, x, y, {from: creator});

I have created a sample contract and test below:

SimpleToken.sol

// contracts/SimpleToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";

/**
 * @title SimpleToken
 * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
 * Note they can later distribute these tokens as they wish using `transfer` and other
 * `ERC20` functions.
 */
contract SimpleToken is Initializable, ERC20UpgradeSafe {

    event TransferXY(uint256 x, uint256 y);

    function initialize(address creator) public initializer {
        __Context_init_unchained();
        __ERC20_init_unchained("SimpleToken", "SIM");
        _mint(creator, 10000 * (10 ** uint256(decimals())));
    }

    function transfer(address recipient, uint256 amount, uint256 x, uint256 y) public virtual returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        emit TransferXY(x, y);
        return true;
    }
}

SimpleToken.test.js

Test implementation contract

// test/SimpleToken.test.js

// Load dependencies
const { accounts, contract } = require('@openzeppelin/test-environment');
const { BN, expectEvent } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');

// Load compiled artifacts
const SimpleToken = contract.fromArtifact('SimpleToken');

// Start test block
describe('SimpleToken', function () {
  const [ creator, other ] = accounts;

  beforeEach(async function () {
    // Deploy a new SimpleToken contract for each test
    this.token = await SimpleToken.new({ from: creator });
    await this.token.initialize(creator);
  });

  // Test case
  it('transfer amount to other account', async function () {
    const amount = new BN('42');
    const receipt = await this.token.transfer(other, amount, {from: creator});
    expect(await this.token.balanceOf(other)).to.be.bignumber.equal(amount);
    expectEvent(receipt, 'Transfer', { from: creator, to: other, value: amount });
  });

  it('transfer amount to other account', async function () {
    const amount = new BN('42');
    const x = new BN('1');
    const y = new BN('2');
    const receipt = await this.token.methods['transfer(address,uint256,uint256,uint256)'](other, amount, x, y, {from: creator});
    expect(await this.token.balanceOf(other)).to.be.bignumber.equal(amount);
    expectEvent(receipt, 'Transfer', { from: creator, to: other, value: amount });
    expectEvent(receipt, 'TransferXY', { x: x, y: y });
  });
});

As an aside, if you are using Truffle, you could look at using OpenZeppelin Upgrades Plugins.
Documentation: https://docs.openzeppelin.com/upgrades-plugins/1.x/
Tutorial: OpenZeppelin Truffle Upgrades: Step by Step Tutorial

OpenZeppelin Test Helpers includes a bn.js object: https://docs.openzeppelin.com/test-helpers/0.5/api#bn