aboutsummaryrefslogtreecommitdiffstats
path: root/formatters.outputBlockFormatter.js
blob: a94c87b3715ce7d666e2ec77d0c68f913d5c0c82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
var chai = require('chai');
var assert = chai.assert; 
var formatters = require('../lib/web3/formatters.js');
var BigNumber = require('bignumber.js');

describe('formatters', function () {
    describe('outputBlockFormatter', function () {
        it('should return the correct value', function () {
            
            assert.deepEqual(formatters.outputBlockFormatter({
                hash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                parentHash: '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265',
                miner: '0xdcc6960376d6c6dea93647383ffb245cfced97cf',
                stateRoot: '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583',
                sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
                bloom: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                difficulty: '0x3e8',
                totalDifficulty: '0x3e8',
                number: '0x3e8',
                gasLimit: '0x3e8',
                gasUsed: '0x3e8',
                timestamp: '0x3e8',
                extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                nonce: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                size: '0x3e8'
            }), {
                hash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                parentHash: '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265',
                miner: '0xdcc6960376d6c6dea93647383ffb245cfced97cf',
                stateRoot: '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583',
                sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
                bloom: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                difficulty: new BigNumber(1000),
                totalDifficulty: new BigNumber(1000),
                number: 1000,
                gasLimit: 1000,
                gasUsed: 1000,
                timestamp: 1000,
                extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                nonce: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                size: 1000
            });
        });
        it('should return the correct value, when null values are present', function () {
            
            assert.deepEqual(formatters.outputBlockFormatter({
                hash: null,
                parentHash: '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265',
                miner: null,
                stateRoot: '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583',
                sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
                bloom: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                difficulty: '0x3e8',
                totalDifficulty: '0x3e8',
                number: null,
                gasLimit: '0x3e8',
                gasUsed: '0x3e8',
                timestamp: '0x3e8',
                extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                nonce: null,
                size: '0x3e8'
            }), {
                hash: null,
                parentHash: '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265',
                miner: null,
                stateRoot: '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583',
                sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
                bloom: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                difficulty: new BigNumber(1000),
                totalDifficulty: new BigNumber(1000),
                number: null,
                gasLimit: 1000,
                gasUsed: 1000,
                timestamp: 1000,
                extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265',
                nonce: null,
                size: 1000
            });
        });
    });
});