git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 59095b0502d442d94aafa6267d3d4e3cb01d7ba6

Tests: use two-level hierarchy for block level values

Alex Beregszaszi committed on 8/23/2016, 1:18:41 AM
Parent: 3a9b5f4c35935e1878a5aa201e5d3b00844c7aac

Files changed

testEnvironment.jschanged
tests/interface/coinbase.jsonchanged
testEnvironment.jsView
@@ -1,8 +1,9 @@
11 const Environment = require('./environment.js')
22 const U256 = require('./u256.js')
33 const Address = require('./address.js')
44 const Block = require('./block.js')
5+const ethUtil = require('ethereumjs-util')
56
67 module.exports = class TestEnvironment extends Environment {
78 constructor (data) {
89 super()
@@ -49,31 +50,33 @@
4950 if (data.gasLeft) {
5051 self.gasLeft = data.gasLeft
5152 }
5253
53- let block = {}
54+ if (data.block) {
55+ let block = {}
5456
55- if (data.blockNumber) {
56- block.number = data.blockNumber
57- }
57+ if (data.block.blockNumber) {
58+ block.number = ethUtil.toBuffer(data.block.blockNumber)
59+ }
5860
59- if (data.gasLimit) {
60- block.gasLimit = data.gasLimit
61- }
61+ if (data.block.gasLimit) {
62+ block.gasLimit = ethUtil.toBuffer(data.block.gasLimit)
63+ }
6264
63- if (data.difficulty) {
64- block.difficulty = adta.difficulty
65- }
65+ if (data.block.difficulty) {
66+ block.difficulty = ethUtil.toBuffer(data.block.difficulty)
67+ }
6668
67- if (data.timestamp) {
68- block.timestamp = data.timestamp
69- }
69+ if (data.block.timestamp) {
70+ block.timestamp = ethUtil.toBuffer(data.block.timestam)
71+ }
7072
71- if (data.coinbase) {
72- block.coinbase = data.coinbase
73- }
73+ if (data.block.coinbase) {
74+ block.coinbase = ethUtil.toBuffer(data.block.coinbase)
75+ }
7476
75- if (Object.keys(block).length > 0) {
76- self.block = new Block({ header: block, transactions: [], uncleHeaders: [] })
77+ if (Object.keys(block).length > 0) {
78+ self.block = new Block({ header: block, transactions: [], uncleHeaders: [] })
79+ }
7780 }
7881 }
7982 }
tests/interface/coinbase.jsonView
@@ -1,3 +1,5 @@
11 {
2- "coinbase": "0x5d48c1018904a172886829bbbd9c6f4a2d06c47b"
2+ "block": {
3+ "coinbase": "0x5d48c1018904a172886829bbbd9c6f4a2d06c47b"
4+ }
35 }

Built with git-ssb-web