Add test for Reject message
This commit is contained in:
parent
1dfdd66b72
commit
6a88aaae9b
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var should = require('chai').should();
|
var should = require('chai').should();
|
||||||
|
var expect = require('chai').expect;
|
||||||
var P2P = require('../../../');
|
var P2P = require('../../../');
|
||||||
var Messages = P2P.Messages;
|
var Messages = P2P.Messages;
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
@ -263,6 +264,28 @@ describe('Command Messages', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Reject', function() {
|
||||||
|
it('should set properties from arg in constructor', function() {
|
||||||
|
var message = messages.Reject({
|
||||||
|
message: 'tx',
|
||||||
|
ccode: 0x01,
|
||||||
|
reason: 'transaction is malformed',
|
||||||
|
data: new Buffer('12345678901234567890123456789012', 'hex')
|
||||||
|
});
|
||||||
|
message.message.should.equal('tx');
|
||||||
|
message.ccode.should.equal(0x01);
|
||||||
|
message.reason.should.equal('transaction is malformed');
|
||||||
|
message.data.toString('hex').should.equal('12345678901234567890123456789012');
|
||||||
|
});
|
||||||
|
it('should let arg be optional in constructor', function() {
|
||||||
|
var message = messages.Reject();
|
||||||
|
expect(message.message).to.be.undefined;
|
||||||
|
expect(message.ccode).to.be.undefined;
|
||||||
|
expect(message.reason).to.be.undefined;
|
||||||
|
expect(message.data).to.be.undefined;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('Version', function() {
|
describe('Version', function() {
|
||||||
it('should set the default relay property as true', function() {
|
it('should set the default relay property as true', function() {
|
||||||
var message = messages.Version();
|
var message = messages.Version();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user