github.com/core-coin/go-core/v2@v2.1.9/tests/ylem/test/opCodes.js (about) 1 // Copyright 2019 by the Authors 2 // This file is part of the go-core library. 3 // 4 // The go-core library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-core library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-core library. If not, see <http://www.gnu.org/licenses/>. 16 17 const TodoList = artifacts.require('./OpCodes.sol') 18 const assert = require('assert') 19 let contractInstance 20 const Web3 = require('web3'); 21 const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); 22 // const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:9545')); 23 24 contract('OpCodes', (accounts) => { 25 beforeEach(async () => { 26 contractInstance = await TodoList.deployed() 27 }) 28 it('Should run without errors the majorit of opcodes', async () => { 29 await contractInstance.test() 30 await contractInstance.test_stop() 31 32 }) 33 34 it('Should throw invalid op code', async () => { 35 try{ 36 await contractInstance.test_invalid() 37 } 38 catch(error) { 39 console.error(error); 40 } 41 }) 42 43 it('Should revert', async () => { 44 try{ 45 await contractInstance.test_revert() } 46 catch(error) { 47 console.error(error); 48 } 49 }) 50 })