github.com/teleloco/go-ethereum@v1.9.7/tests/solidity/test/opCodes.js (about)

     1  const TodoList = artifacts.require('./OpCodes.sol')
     2  const assert = require('assert')
     3  let contractInstance
     4  const Web3 = require('web3');
     5  const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
     6  // const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:9545'));
     7  
     8  contract('OpCodes', (accounts) => {
     9     beforeEach(async () => {
    10        contractInstance = await TodoList.deployed()
    11     })
    12     it('Should run without errors the majorit of opcodes', async () => {
    13       await contractInstance.test()
    14       await contractInstance.test_stop()
    15  
    16     })
    17  
    18     it('Should throw invalid op code', async () => {
    19      try{
    20        await contractInstance.test_invalid()
    21      }
    22      catch(error) {
    23        console.error(error);
    24      }
    25     })
    26  
    27     it('Should revert', async () => {
    28      try{
    29        await contractInstance.test_revert()    }
    30      catch(error) {
    31        console.error(error);
    32      }
    33     })
    34  })