title: how do I fix this error? ReferenceError: totalSupply is not defined
body: <p>Im using a course, and I got this error:</p>
  <pre><code>ReferenceError: totalSupply is not defined
  </code></pre>
  <p>and Idk what it means by that, cause I never got this error before.
  can somebody help me fix this error? thanks
  and this is my code:</p>
  <pre><code>const { assert } = require(&quot;chai&quot;);
  
  const KryptoBird = artifacts.require(&quot;KryptoBird&quot;);
  
  // check for chai
  require('chai')
  .use(require('chai-as-promised'))
  .should()
  
  contract('KryptoBird', (accounts) =&gt; {
  
      let contract
      before( async () =&gt; {
      contract = await KryptoBird.deployed()
      })
      
      
      
      describe('deployment', async() =&gt; {
          it(&quot;deploys successfully&quot;, async () =&gt; {
              const address = contract.address;
              assert.notEqual(address, '')
              assert.notEqual(address, null)
              assert.notEqual(address, undefined)
              assert.notEqual(address, 0x0)
          })
          it('has a name', async() =&gt; {
              const name = await contract.name()
              assert.equal(name, 'KryptoBird')
          }) 
  
          it('has a symbol', async() =&gt; {
              const symbol = await contract.symbol()
              assert.equal(symbol, 'KBIRDZ')
          })
  
      }) 
  
      describe('minting', async ()=&gt; {
          it('creates a new token', async ()=&gt; {
              const result = await contract.mint('https...1')
              const totalSupply = await contract.totalSupply();
              assert.equal(totalSupply, 1)
              const event = result.logs[0].args
              assert.equal(event._from, '0x0000000000000000000000000000000000000000', 'from is the contract')
              assert.equal(event._to, accounts[0], 'to is msg.sender')
  
              await contract.mint('https...1').should.be.rejected
          })
      })
  
      describe('indexing', async()=&gt; {
          it('lists KryptoBirdz', async()=&gt; {            
          // Mint three new tokens
          await contract.mint('https...2')
          await contract.mint('https...3')
          await contract.mint('https...4')
          const totalSupply = await contract.totalSupply()
          })
  
          let result = []
          let KryptoBird
          for(i = 1; i &lt;= totalSupply; i++) {
              KryptoBird = await contract.kryptoBirdz(i)
              result.push(KryptoBird)
      }
  
      let expected = ['https...1','https...2','https...3','https...4']
      assert.equal(result.join(','), expected.join(','))
  
  })
  
  })
  </code></pre>
  <p>if u need another contract, just tell me, and if u could help me, thanks so much, because I need to finish this today. I've been trying to fix this for 2 hours, it didnt work. so please, if u could help me, it would mean a LOT to me.</p>
  <p>here:</p>
  <pre><code>// SPDX-License-Identifier: MIT
  pragma solidity ^0.8.7;
  
  import './ERC721Connecter.sol';
  
  contract KryptoBird is ERC721Connecter {
  
      string[] public kryptoBirdz;
  
      mapping(string =&gt; bool) _kryptoBirdzExists;
  
      function mint(string memory _kryptoBird) public {
          
          require(!_kryptoBirdzExists[_kryptoBird],
          'Error - kryptoBird already exists');
  
          // this is deprecated - uint _id = KryptoBirdz.push(_kryptoBird);
          kryptoBirdz.push(_kryptoBird);
          uint _id = kryptoBirdz.length - 1;
  
          // .push no logner returns the length but a ref to the added element
          _mint(msg.sender, _id);
           _kryptoBirdzExists[_kryptoBird]=true;
  
  
      }
      
  
  constructor() ERC721Connecter('KryptoBird','KBIRDZ')
  {}
  
  }
  </code></pre>