Solidity test suite, with helper functions. Use with Truffle and Mocha!
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
Luiserebii 8a83db5454
Bumping up version to v0.0.7-alpha
11 месяцев назад
src Really minor improvement, removing console.log 11 месяцев назад
.gitattributes Adding .gitattributes 11 месяцев назад
.gitignore Initial commit 11 месяцев назад
LICENSE Adding LICENSE 11 месяцев назад
README.md Edits and corrections to README.md, placing errors.js in index.js module 11 месяцев назад
index.js Minor re-organization, so bumping version up 11 месяцев назад
package-lock.json Initial commit 11 месяцев назад
package.json Bumping up version to v0.0.7-alpha 11 месяцев назад

README.md

solidity-test

npm version

A simple node module to aid smart contract development in testing contracts. Initially created due to the desire to modularize testing for reverts, now looking to expand into something more definite.

Quick Example

const solidityTest = require('solidityTest');
const solAssert = solidityTest.solAssert;

const notOwner = '0x00000000000000000000000000000000000';

//Within Mocha:

it('reverts transaction', async () => {
  
  await solAssert.revert(
    async () => {  
      someContract.functionOnlyOwnerCanCall().send({from: notOwner});
    }
  )
  
})

And, if perhaps testing for ownership, and wanting to be strict about the kind of error received:

const solidityTest = require('solidityTest');
const solAssert = solidityTest.solAssert;
const errors = solidityTest.errors;

const notOwner = '0x00000000000000000000000000000000000';

//Within Mocha:

it('reverts transaction', async () => {

  //Passing an error string to revert will only pass when the error string is matched
  await solAssert.revert(
    async () => {
      someContract.functionOnlyOwnerCanCall().send({from: notOwner});
    }, errors.openzeppelin.ownable // which is: 'Ownable: caller is not the owner'
  )

})