opCodes.js 905 B

12345678910111213141516171819202122232425262728293031323334
  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. contract('OpCodes', (accounts) => {
  8. beforeEach(async () => {
  9. contractInstance = await TodoList.deployed()
  10. })
  11. it('Should run without errors the majorit of opcodes', async () => {
  12. await contractInstance.test()
  13. await contractInstance.test_stop()
  14. })
  15. it('Should throw invalid op code', async () => {
  16. try{
  17. await contractInstance.test_invalid()
  18. }
  19. catch(error) {
  20. console.error(error);
  21. }
  22. })
  23. it('Should revert', async () => {
  24. try{
  25. await contractInstance.test_revert() }
  26. catch(error) {
  27. console.error(error);
  28. }
  29. })
  30. })