2015-03-07 18:18:22 +00:00
|
|
|
var chai = require('chai');
|
|
|
|
var assert = chai.assert;
|
2015-03-22 08:43:07 +00:00
|
|
|
var formatters = require('../lib/web3/formatters.js');
|
2015-02-27 11:41:07 +00:00
|
|
|
|
|
|
|
describe('formatters', function () {
|
|
|
|
describe('inputPostFormatter', function () {
|
|
|
|
it('should return the correct value', function () {
|
|
|
|
|
|
|
|
// input as strings and numbers
|
2015-03-23 12:42:36 +00:00
|
|
|
assert.deepEqual(formatters.inputPostFormatter({
|
2015-02-27 11:41:07 +00:00
|
|
|
from: '0x00000',
|
|
|
|
to: '0x00000',
|
2015-03-09 14:09:21 +00:00
|
|
|
payload: {test: 'test'},
|
2015-02-27 11:41:07 +00:00
|
|
|
ttl: 200,
|
2015-03-10 16:27:36 +00:00
|
|
|
priority: 1000,
|
2015-03-10 15:22:16 +00:00
|
|
|
topics: ['hello','mytopics']
|
2015-03-23 12:42:36 +00:00
|
|
|
}), {
|
2015-02-27 11:41:07 +00:00
|
|
|
from: '0x00000',
|
|
|
|
to: '0x00000',
|
|
|
|
payload: '0x7b2274657374223a2274657374227d',
|
|
|
|
ttl: '0xc8',
|
2015-03-10 16:27:36 +00:00
|
|
|
priority: '0x3e8',
|
2015-04-16 10:22:06 +00:00
|
|
|
topics: ['0x68656c6c6f','0x6d79746f70696373'],
|
|
|
|
workToProve: '0x0'
|
2015-03-23 12:42:36 +00:00
|
|
|
});
|
2015-02-27 11:41:07 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
});
|
2015-03-07 18:18:22 +00:00
|
|
|
});
|
2015-03-22 08:43:07 +00:00
|
|
|
|