【发布时间】:2022-11-12 00:45:41
【问题描述】:
我创建了solidity合约并成功用松露编译它但是当我对我的合约的测试文件运行松露测试时它给出了错误
类型错误:assert.equal 不是函数
我的代码
const { assert } = require('console'); const Tether = artifacts.require('Tether.sol'); const RWD = artifacts.require('RWD'); const DecentralBank = artifacts.require('DecentralBank'); require('chai') .use(require('chai-as-promised')) .should() contract('DecentralBank', ([owner, customer]) => { let tether, rwd, decentralBank; function tokens(number) { return web3.utils.toWei(number, 'ether') } before(async () => { tether = await Tether.new() rwd = await RWD.new() decentralBank = await DecentralBank.new(rwd.address, tether.address) await rwd.transfer(decentralBank.address, tokens('1000000')); await tether.transfer(customer, tokens('100'),{from: owner}); }) describe('Tether', async () =>{ it('matches name successfully', async () => { const name = await tether.name() console.log(name) assert.equal(name, 'Tether') }) }) })
【问题讨论】:
标签: reactjs solidity web3js truffle