Search code examples
error-handlingblockchainethereumsoliditytruffle

an error in truffle test with "It" statement


I am using a course, from udemy, it is called "The Complete NFT Web Development Course - Zero To Expert" and I got an error, at 174, I am making a smart contract, called 'Kryptobird.js' and got an error. if theres anything wrong with the code, please help me

const assert = require('chai')

const KryptoBird = artifacts.require('./KryptoBird')

// check for chai
require('chai')
.use(require('chai-as-promised'))
.should()
contract('KryptoBird', (accounts) => {
let contract


describe('deployment', async() => {
    It('deploys successfuly', async() => {
        contract = await KryptoBird.deployed()
        const address = contract.address;
        assert.notEqual(address, '')
        assert.notEqual(address, null)
        assert.notEqual(address, undefined)
        assert.notEqual(address, 0x0)
    })
}) 
})

and this is the error I'm getting when I run the command 'truffle test' :

error message


Solution

  • 1- It should not be capital "I"

    it("deploys successfully", async () => {
    

    2- also this might cause error artifacts.require('./KryptoBird')

    it should not be the relative path. it should be the name of the contract

    const KryptoBird = artifacts.require("KryptoBird");
    

    3-

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