Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

271
Visualizações
Truffle tests, Type Error: it is not a function

I am new to testing with java script and also new to writing smart contracts. I have watched some tutorials regarding writing the tests and tried to orientate my test with for example the Metacoin example from truffle.

Now when I try to run my basic first test to get the total supply of my ERC20 token, i get the following error message:

  1. Uncaught error outside test suite

0 passing (2ms) 1 failing

  1. Uncaught error outside test suite: Uncaught TypeError: it is not a function

My test code looks like this:

const { assert } = require("console");
const { it } = require("ethers/wordlists");

const charytoken = artifacts.require("CharyToken"); 

contract("CharyToken test", async accounts => {
    it("should get the Balance of CT of this contract", async() => {
        const instance = await charytoken.deployed(); 
        const ctbalance = await instance.totalSupply.call(); 
        assert.equal(ctbalance.valueOf(), 10000000000000000000000);
    }); 
}); 

If anyone knows what I am doing wrong/ I am missing, I would appreachiate help a lot!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It's because you imported the wrong it. It's not from ethers/wordlist

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda