remix-lib tests working fine

toaster-react
aniket-engg 4 years ago committed by Aniket
parent 8b521cefbb
commit a5aa8cdca3
  1. 2
      libs/remix-lib/src/execution/execution-context.ts
  2. 16
      libs/remix-lib/test/eventManager.ts
  3. 10
      libs/remix-lib/test/tests.ts
  4. 21
      libs/remix-lib/test/txFormat.ts
  5. 4
      libs/remix-lib/test/txHelper.ts
  6. 7
      libs/remix-lib/test/txResultHelper.ts
  7. 4
      libs/remix-lib/test/util.ts
  8. 14
      workspace.json

@ -7,7 +7,7 @@ import { Web3VmProvider } from '../web3Provider/web3VmProvider'
const EthJSVM = require('ethereumjs-vm').default
const StateManager = require('ethereumjs-vm/dist/state/stateManager').default
const LogsManager = require('./logsManager.js')
import { LogsManager } from './logsManager'
declare let ethereum: any
let web3

@ -1,33 +1,33 @@
'use strict'
const tape = require('tape')
const EventManager = require('../src/eventManager')
import tape from 'tape'
import { EventManager } from '../src/eventManager'
tape('eventManager', function (t) {
t.test('eventManager', function (st) {
const events = new EventManager()
const listenner = {}
let trace = ''
listenner.listen = function (data1) {
listenner['listen'] = function (data1) {
trace += data1
}
const registeredFunction = function (data) {
trace += data
}
events.register('event1', listenner, listenner.listen)
events.register('event2', registeredFunction)
events.register('event1', listenner, listenner['listen'])
events.register('event2', registeredFunction, null)
events.trigger('event1', ['event1'])
events.trigger('event2', ['event2'])
st.equal(trace, 'event1event2')
events.unregister('event1', listenner.listen)
events.unregister('event1', listenner['listen'], null)
st.equal(events.registered['event1'].length, 1)
st.equal(events.registered['event2'].length, 1)
events.unregister('event1', listenner, listenner.listen)
events.unregister('event1', listenner, listenner['listen'])
st.equal(events.registered['event1'].length, 0)
st.equal(events.registered['event2'].length, 1)
events.unregister('event2', registeredFunction)
events.unregister('event2', registeredFunction, null)
st.equal(events.registered['event1'].length, 0)
st.equal(events.registered['event2'].length, 0)
st.end()

@ -1,5 +1,5 @@
require('./eventManager.js')
require('./util.js')
require('./txFormat.js')
require('./txHelper.js')
require('./txResultHelper.js')
require('./eventManager.ts')
require('./util.ts')
require('./txFormat.ts')
require('./txHelper.ts')
require('./txResultHelper.ts')

@ -1,11 +1,12 @@
'use strict'
import * as tape from 'tape'
const txFormat = require('../src/execution/txFormat')
const txHelper = require('../src/execution/txHelper')
const util = require('../src/util')
import tape from 'tape'
import * as txFormat from '../src/execution/txFormat'
import * as txHelper from '../src/execution/txHelper'
import { hexToIntArray } from '../src/util'
let compiler = require('solc')
const compilerInput = require('../src/helpers/compilerHelper').compilerInput
const executionContext = require('../').execution.executionContext
import { compilerInput } from '../src/helpers/compilerHelper'
import { ExecutionContext } from '../src/execution/execution-context'
const executionContext = new ExecutionContext()
const solidityVersion = 'v0.6.0+commit.26b70077'
/* tape *********************************************************** */
@ -150,7 +151,7 @@ function testInvalidTupleInput (st, params) {
/* tape *********************************************************** */
tape('ContractParameters - (TxFormat.buildData) - link Libraries', function (t) {
executionContext.setContext('vm')
executionContext.setContext('vm', null, null, null)
const compileData = compiler.compile(compilerInput(deploySimpleLib))
const fakeDeployedContracts = {
@ -293,7 +294,7 @@ tape('test abiEncoderV2', function (t) {
console.log(error)
st.equal(encoded.dataHex, functionId + encodedData.replace('0x', ''))
})
let decoded = txFormat.decodeResponse(util.hexToIntArray(encodedData), contract.abi[0])
let decoded = txFormat.decodeResponse(hexToIntArray(encodedData), contract.abi[0])
console.log(decoded)
st.equal(decoded[0], `tuple(uint256,uint256,string): ${value1},${value2},${value3}`)
})
@ -314,14 +315,14 @@ tape('test abiEncoderV2 array of tuple', function (t) {
const contract = output.contracts['test.sol']['test']
txFormat.encodeParams('[34, "test"]', contract.abi[1], (error, encoded) => {
console.log(error)
const decoded = txFormat.decodeResponse(util.hexToIntArray(encoded.dataHex), contract.abi[1])
const decoded = txFormat.decodeResponse(hexToIntArray(encoded.dataHex), contract.abi[1])
console.log(decoded)
st.equal(decoded[0], 'tuple(uint256,string): _strucmts 34,test')
})
txFormat.encodeParams('[[34, "test"], [123, "test2"]]', contract.abi[2], (error, encoded) => {
console.log(error)
const decoded = txFormat.decodeResponse(util.hexToIntArray(encoded.dataHex), contract.abi[2])
const decoded = txFormat.decodeResponse(hexToIntArray(encoded.dataHex), contract.abi[2])
console.log(decoded)
st.equal(decoded[0], 'tuple(uint256,string)[]: strucmts 34,test,123,test2')
})

@ -1,6 +1,6 @@
'use strict'
const tape = require('tape')
const txHelper = require('../src/execution/txHelper')
import tape from 'tape'
import * as txHelper from '../src/execution/txHelper'
tape('getFunction', function (st) {
st.plan(6)

@ -1,9 +1,8 @@
'use strict'
const tape = require('tape')
const { BN, toBuffer } = require('ethereumjs-util')
const { resultToRemixTx } = require('../src/helpers/txResultHelper')
import tape from 'tape'
import { BN, toBuffer } from 'ethereumjs-util'
import { resultToRemixTx } from '../src/helpers/txResultHelper'
const TRANSACTION_HASH = '0x538ad944d09c2df403f064c1e4556fae877fe3f1b600c567622e330c2bdbbe2e'
const CONTRACT_ADDRESS_HEX = '0x692a70d2e424a56d2c6c27aa97d1a86395877b3a'

@ -1,6 +1,6 @@
'use strict'
const tape = require('tape')
const util = require('../src/util')
import tape from 'tape'
import * as util from '../src/util'
tape('Util', function (t) {
t.test('lowerbound', function (st) {

@ -128,7 +128,7 @@
"test": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": ["npm-run-all test"],
"commands": ["./../../node_modules/.bin/npm-run-all test"],
"cwd": "libs/remix-analyzer"
}
},
@ -162,7 +162,7 @@
"test": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": ["npm-run-all test"],
"commands": ["./../../node_modules/.bin/npm-run-all test"],
"cwd": "libs/remix-astwalker"
}
},
@ -196,7 +196,7 @@
"test": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": ["npm-run-all test"],
"commands": ["./../../node_modules/.bin/npm-run-all test"],
"cwd": "libs/remix-debug"
}
},
@ -241,7 +241,7 @@
"test": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": ["npm-run-all test"],
"commands": ["./../../node_modules/.bin/npm-run-all test"],
"cwd": "libs/remix-lib"
}
},
@ -275,7 +275,7 @@
"test": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": ["npm-run-all test"],
"commands": ["./../../node_modules/.bin/npm-run-all test"],
"cwd": "libs/remix-simulator"
}
},
@ -320,7 +320,7 @@
"test": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": ["npm-run-all test"],
"commands": ["./../../node_modules/.bin/npm-run-all test"],
"cwd": "libs/remix-solidity"
}
},
@ -402,7 +402,7 @@
"test": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": ["npm-run-all test"],
"commands": ["./../../node_modules/.bin/npm-run-all test"],
"cwd": "libs/remix-url-resolver"
}
},

Loading…
Cancel
Save