Skip to content
This repository was archived by the owner on Jun 17, 2021. It is now read-only.

Commit 04596ae

Browse files
committed
Update defineFields tests.
They were using the previous behavior of toBuffer unnecessarily.
1 parent 4a8001c commit 04596ae

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

test/defineFields.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,22 @@ describe('define', function () {
5555
it('it should accept rlp encoded intial data', function () {
5656
var someOb = {}
5757
var data = {
58-
aword: 'test',
59-
cannotBeZero: 'not zero',
60-
value: 'a value',
61-
r: 'rrr'
58+
aword: '0x01',
59+
cannotBeZero: '0x02',
60+
value: '0x03',
61+
r: '0x04'
6262
}
6363

6464
var expected = {
65-
aword: '0x74657374',
65+
aword: '0x01',
6666
empty: '0x',
67-
cannotBeZero: '0x6e6f74207a65726f',
68-
value: '0x612076616c7565',
69-
r: '0x727272'
67+
cannotBeZero: '0x02',
68+
value: '0x03',
69+
r: '0x04'
7070
}
7171

7272
var expectedArray = [
73-
'0x74657374', '0x', '0x6e6f74207a65726f', '0x612076616c7565', '0x727272'
73+
'0x01', '0x', '0x02', '0x03', '0x04'
7474
]
7575

7676
ethUtil.defineProperties(someOb, fields, data)
@@ -100,25 +100,25 @@ describe('define', function () {
100100
it('alias should work ', function () {
101101
var someOb = {}
102102
var data = {
103-
aword: 'test',
104-
cannotBeZero: 'not zero',
105-
value: 'a value',
106-
r: 'rrr'
103+
aword: '0x01',
104+
cannotBeZero: '0x02',
105+
value: '0x03',
106+
r: '0x04'
107107
}
108108

109109
ethUtil.defineProperties(someOb, fields, data)
110-
assert.equal(someOb.blah.toString(), 'test')
111-
someOb.blah = 'lol'
112-
assert.equal(someOb.blah.toString(), 'lol')
113-
assert.equal(someOb.aword.toString(), 'lol')
110+
assert.equal(someOb.blah.toString('hex'), '01')
111+
someOb.blah = '0x09'
112+
assert.equal(someOb.blah.toString('hex'), '09')
113+
assert.equal(someOb.aword.toString('hex'), '09')
114114
})
115115

116116
it('alias should work #2', function () {
117117
var someOb = {}
118-
var data = { blah: '42' }
118+
var data = { blah: '0x1' }
119119

120120
ethUtil.defineProperties(someOb, fields, data)
121-
assert.equal(someOb.blah, '42')
122-
assert.equal(someOb.aword, '42')
121+
assert.equal(someOb.blah.toString('hex'), '01')
122+
assert.equal(someOb.aword.toString('hex'), '01')
123123
})
124124
})

0 commit comments

Comments
 (0)