Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
Cannot read properties of undefined (reading 'equal')

TypeError: Cannot read properties of undefined (reading 'equal') and also in truffle console when i try to see the number of candidates it is also undefined. is there any problme with the command (.candidatesCount().toNumber)?

const { assert } = require("assert");


var Election = artifacts.require("./Election.sol");

contract("Election", function (acc) {
  it("initializes with two candidates", function () {
    return Election.deployed()
      .then(function (ins) {
        return ins.candidatesCount();
      })
      .then(function (count) {
        assert.equal(count, 2);
      });
  });
});
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

assert gets exported with a default export (module.exports = function assert() {...}) so you need to import it accordingly.

const assert = require('assert');
about 4 years ago · Juan Pablo Isaza Report

0

const assert = require("assert");

Why import a name value? That's whats causing the issue

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!