add tests for misc endpoints

pull/7/head
Iuri Matias 6 years ago
parent 9ef716ff7c
commit 6acf1021f3
  1. 62
      remix-simulator/test/misc.js

@ -10,8 +10,9 @@ describe('Misc', function () {
web3.setProvider(provider) web3.setProvider(provider)
}) })
describe('web3_clientVersion', () => {
it('should get correct remix simulator version', async function (done) { it('should get correct remix simulator version', async function (done) {
web3._requestManager.send({method: 'web3_clientVersion', params: []}, (err, version) => { web3._requestManager.send({ method: 'web3_clientVersion', params: [] }, (err, version) => {
if (err) { if (err) {
throw new Error(err) throw new Error(err)
} }
@ -20,37 +21,92 @@ describe('Misc', function () {
done() done()
}) })
}) })
})
describe('eth_protocolVersion', () => {
it('should get protocol version', async function () { it('should get protocol version', async function () {
web3._requestManager.send({method: 'eth_protocolVersion', params: []}, (err, result) => { web3._requestManager.send({ method: 'eth_protocolVersion', params: [] }, (err, result) => {
if (err) { if (err) {
throw new Error(err) throw new Error(err)
} }
assert.equal(result, '0x3f') assert.equal(result, '0x3f')
}) })
}) })
})
describe('eth_syncing', () => {
it('should get if is syncing', async function () { it('should get if is syncing', async function () {
let isSyncing = await web3.eth.isSyncing() let isSyncing = await web3.eth.isSyncing()
assert.equal(isSyncing, false) assert.equal(isSyncing, false)
}) })
})
describe('eth_mining', () => {
it('should get if is mining', async function () { it('should get if is mining', async function () {
let isMining = await web3.eth.isMining() let isMining = await web3.eth.isMining()
assert.equal(isMining, false) assert.equal(isMining, false)
}) })
})
describe('eth_hashrate', () => {
it('should get hashrate', async function () { it('should get hashrate', async function () {
let hashrate = await web3.eth.getHashrate() let hashrate = await web3.eth.getHashrate()
assert.equal(hashrate, 0) assert.equal(hashrate, 0)
}) })
})
describe('web3_sha3', () => {
it('should get result of a sha3', async function () { it('should get result of a sha3', async function () {
web3._requestManager.send({method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64']}, (err, result) => { web3._requestManager.send({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] }, (err, result) => {
if (err) { if (err) {
throw new Error(err) throw new Error(err)
} }
assert.equal(result, '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad') assert.equal(result, '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad')
}) })
}) })
})
describe('eth_getCompilers', () => {
it('should get list of compilers', async function () {
web3._requestManager.send({ method: 'eth_getCompilers', params: [] }, (err, result) => {
if (err) {
throw new Error(err)
}
assert.equal(result, 0)
})
})
})
describe('eth_compileSolidity', () => {
it('get unsupported result when requesting solidity compiler', async function () {
web3._requestManager.send({ method: 'eth_compileSolidity', params: [] }, (err, result) => {
if (err) {
throw new Error(err)
}
assert.equal(result, 'unsupported')
})
})
})
describe('eth_compileLLL', () => {
it('get unsupported result when requesting LLL compiler', async function () {
web3._requestManager.send({ method: 'eth_compileLLL', params: [] }, (err, result) => {
if (err) {
throw new Error(err)
}
assert.equal(result, 'unsupported')
})
})
})
describe('eth_compileSerpent', () => {
it('get unsupported result when requesting serpent compiler', async function () {
web3._requestManager.send({ method: 'eth_compileSerpent', params: [] }, (err, result) => {
if (err) {
throw new Error(err)
}
assert.equal(result, 'unsupported')
})
})
})
}) })

Loading…
Cancel
Save