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

148
Views
How Can i Exports the Solidity Function in mocha and chai testing?

Hello i am using mocha and chai testing framework and library into the below code but this code give me a error at the time of when i am create the products using cretateProducts function. and the error in createProducts is not a function.

var TestForSmartContract = artifacts.require('MarketPlace.sol');
var assert = require('assert');

contract("MarketPlace",(accounts)=>{
    let marketplace;
    describe('Deploy Or Not',()=>{
        it("Deploy SuccessFully",()=>{
            const address =  TestForSmartContract.address;
            assert.notEqual(address,"");
            assert.notEqual(address,0x0);
            assert.notEqual(address,null);
            assert.notEqual(address,undefined);

        });

        
    })

    describe("For The Products",()=>{
        let createProducts;
        let counts;
        before(async()=>{
             createProducts = TestForSmartContract.CrateProducts('I-Phone',web3.utils.toWei('1','Ether'));
             counts = TestForSmartContract.productsCount();
        })

        it('The Producst Count',()=>{
            assert.equal(counts,1);
        })
    })
    
})
about 4 years ago · Juan Pablo Isaza
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!