Trouble testing upgradeable contract & ERC721 token

I am now having another issue with testing an ERC721 token. @abcoathup

I am trying to allow the initial EstateAgent admin to mine Deed tokens but when I call balanceOf in the test, it returns 0. Is there something wrong with how they’re interacting with each other?

Or should I be using the test helpers to check events?

Also I read I should be using something like await this.deed.methods['initialize(address)'](admin); for initialising the token but I’m not sure entirely where to place it as I can’t get it to work I think


pragma solidity ^0.5.0;

import '@openzeppelin/upgrades/contracts/Initializable.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/ERC721Full.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/ERC721Mintable.sol';
import "@openzeppelin/contracts-ethereum-package/contracts/drafts/Counters.sol";

contract Deed is Initializable, ERC721Full, ERC721Mintable {
  using Counters for Counters.Counter;
  Counters.Counter private _tokenIds;

  function initialize(address agent) public initializer {
    ERC721Metadata.initialize("Deed", "DEED");

  function createDeed(address to, string memory tokenURI) public returns (uint256){

        uint256 newItemId = _tokenIds.current();
        _mint(to, newItemId);
        _setTokenURI(newItemId, tokenURI);

        return newItemId;


const { accounts, provider } = require('@openzeppelin/test-environment');
const { TestHelper } = require('@openzeppelin/cli');
const { Contracts, ZWeb3 } = require('@openzeppelin/upgrades');

const { BN, balance, ether } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');


const EstateAgent = Contracts.getFromLocal('EstateAgent');
const Deed = Contracts.getFromLocal('Deed');

describe('EstateAgent', function () {
  const [admin, nonAdmin, ...otherAccounts] = accounts;

  beforeEach(async function () {
    this.project = await TestHelper();
    this.agent = await this.project.createProxy(EstateAgent, { initMethod: 'initialize', initArgs: [admin] });
    this.deed = await this.project.createProxy(Deed, { initMethod: 'initialize', initArgs: [admin] })

  describe('Is admin', function () {
    it('Should be admin', async function () {
      expect(await this.agent.methods.isAdmin(admin).call());

    it('Should not be admin', async function () {
      expect(await this.agent.methods.isAdmin(nonAdmin).call());

    it('should create deed', async function () {
      await this.deed.methods.createDeed(admin, 'testurl').call()
      expect(await this.deed.methods.balanceOf(admin).call());
1 Like