Revert when trying to test upgradeable ERC777

Hi @apple,

ERC777 requires an onchain ERC1820 registry. We need to deploy this for local test networks (it is already deployed for mainnet and public testnets)

We can use OpenZeppelin Test Helpers to do this: https://docs.openzeppelin.com/test-helpers/0.5/api#erc1820registry

this.erc1820 = await singletons.ERC1820Registry(registryFunder);

See Simple ERC777 token example

TestContract.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.9;

import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC777/ERC777.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/utils/Pausable.sol";

contract TestContract is Initializable, ContextUpgradeSafe, ERC777UpgradeSafe {
    function initialize(
        address initialHolder,
        uint256 initialBalance,
        string memory name,
        string memory symbol,
        address[] memory defaultOperators
    ) public initializer {
        __Context_init_unchained();
        __ERC777_init_unchained(name, symbol, defaultOperators);
        _mint(initialHolder, initialBalance, "", "");

    }
}

TestContract.test.js

const { accounts, contract, web3 } = require('@openzeppelin/test-environment');
const { BN, expectEvent, expectRevert, singletons, constants } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');

// Based on https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/test/examples/SimpleToken.test.js

const TestContract = contract.fromArtifact('TestContract');

describe('TestContract', function () {

  const [_, registryFunder, creator, operator] = accounts;

  const defaultOperators = [operator];  

  beforeEach(async function () {
    this.erc1820 = await singletons.ERC1820Registry(registryFunder);
    this.token = await TestContract.new({ from: creator });
    await this.token.initialize(creator, '1000000000000000000000', 'TestContract', 'TEST', defaultOperators, { from: creator })
  });

  it('has a name', async function () {
    expect(await this.token.name()).to.equal('TestContract');
  });

  it('has a symbol', async function () {
    expect(await this.token.symbol()).to.equal('TEST');
  });
});