Comparing version 0.2.0 to 0.3.0
@@ -15,4 +15,2 @@ var async = require('async'); | ||
this.previousHash = null; | ||
this.previousVotesRoot = null; | ||
this.previousVotesCount = null; | ||
this.membersRoot = null; | ||
@@ -45,4 +43,2 @@ this.membersCount = 0; | ||
{prop: "previousHash", regexp: /PreviousHash: (.*)/}, | ||
{prop: "previousVotesRoot", regexp: /PreviousVotesRoot: (.*)/}, | ||
{prop: "previousVotesCount",regexp: /PreviousVotesCount: (.*)/}, | ||
{prop: "membersRoot", regexp: /MembersRoot: (.*)/}, | ||
@@ -85,4 +81,2 @@ {prop: "membersCount", regexp: /MembersCount: (.*)/}, | ||
'PREV_HASH': 157, | ||
'PREV_VOTES_ROOT': 158, | ||
'PREV_VOTES_COUNT': 159, | ||
'MEMBERS_ROOT': 160, | ||
@@ -149,12 +143,2 @@ 'MEMBERS_COUNT': 161, | ||
if(!err){ | ||
// PreviousVotesCount | ||
if(this.previousVotesCount && !this.previousVotesCount.match(/^\d+$/)) | ||
err = {code: codes['PREV_VOTES_COUNT'], message: "PreviousVotesCount must be a positive or zero integer"}; | ||
} | ||
if(!err){ | ||
// PreviousVotesRoot | ||
if(this.previousVotesRoot && !this.previousVotesRoot.match(/^[A-Z\d]{40}$/)) | ||
err = {code: codes['PREV_VOTES_ROOT'], message: "PreviousVotesRoot must be provided and match an uppercase SHA1 hash"}; | ||
} | ||
if(!err){ | ||
// VotersRoot | ||
@@ -247,8 +231,2 @@ if(this.previousHash && (!this.votersRoot || !this.votersRoot.match(/^[A-Z\d]{40}$/))) | ||
} | ||
if(this.previousVotesRoot){ | ||
raw += "PreviousVotesRoot: " + this.previousVotesRoot + "\n"; | ||
} | ||
if(this.previousVotesCount){ | ||
raw += "PreviousVotesCount: " + this.previousVotesCount + "\n"; | ||
} | ||
if(this.membersRoot){ | ||
@@ -255,0 +233,0 @@ raw += "MembersRoot: " + this.membersRoot + "\n"; |
{ | ||
"name": "hdc", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "NPM module implementing HDC Messages Format", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -56,10 +56,2 @@ var should = require('should'); | ||
it('should have no previous votes root', function(){ | ||
assert.equal(amTest.previousVotesRoot, 'C8239FF2434490AFE28BA339F53C7237B7C14B19'); | ||
}); | ||
it('should have 3 previous votes count', function(){ | ||
assert.equal(amTest.previousVotesCount, 3); | ||
}); | ||
it('should have F5ACFD67FC908D28C0CFDAD886249AC260515C90 members hash', function(){ | ||
@@ -85,8 +77,8 @@ assert.equal('F5ACFD67FC908D28C0CFDAD886249AC260515C90', amTest.membersRoot); | ||
it('its computed hash should be 5A6434BCD09400625CEA75BFE6F786829018BAD1', function(){ | ||
assert.equal(amTest.hash, '5A6434BCD09400625CEA75BFE6F786829018BAD1'); | ||
it('its computed hash should be F07D0B6DBB7EA99E5208752EABDB8B721C0010E9', function(){ | ||
assert.equal(amTest.hash, 'F07D0B6DBB7EA99E5208752EABDB8B721C0010E9'); | ||
}); | ||
it('its manual hash should be 5A6434BCD09400625CEA75BFE6F786829018BAD1', function(){ | ||
assert.equal(sha1(amTest.getRaw()).toUpperCase(), '5A6434BCD09400625CEA75BFE6F786829018BAD1'); | ||
it('its manual hash should be F07D0B6DBB7EA99E5208752EABDB8B721C0010E9', function(){ | ||
assert.equal(sha1(amTest.getRaw()).toUpperCase(), 'F07D0B6DBB7EA99E5208752EABDB8B721C0010E9'); | ||
}); | ||
@@ -93,0 +85,0 @@ }); |
@@ -52,14 +52,6 @@ var should = require('should'); | ||
it('should have 5A6434BCD09400625CEA75BFE6F786829018BAD1 previous hash', function(){ | ||
assert.equal(amTest.previousHash, '5A6434BCD09400625CEA75BFE6F786829018BAD1'); | ||
it('should have F07D0B6DBB7EA99E5208752EABDB8B721C0010E9 previous hash', function(){ | ||
assert.equal(amTest.previousHash, 'F07D0B6DBB7EA99E5208752EABDB8B721C0010E9'); | ||
}); | ||
it('should have previous votes root 21DDC685FB54AB0520B091E3762845F0AA97C257', function(){ | ||
assert.equal(amTest.previousVotesRoot, '21DDC685FB54AB0520B091E3762845F0AA97C257'); | ||
}); | ||
it('should have 3 previous votes count', function(){ | ||
assert.equal(amTest.previousVotesCount, 3); | ||
}); | ||
it('should have F92B6F81C85200250EE51783F5F9F6ACA57A9AFF members hash', function(){ | ||
@@ -92,8 +84,8 @@ assert.equal(amTest.membersRoot, 'F92B6F81C85200250EE51783F5F9F6ACA57A9AFF'); | ||
it('its computed hash should be B913193383A3BF119A28CA40A664531922DE2ADC', function(){ | ||
assert.equal(amTest.hash, 'B913193383A3BF119A28CA40A664531922DE2ADC'); | ||
it('its computed hash should be 02D8FCAA86A958EE07385C12DCDB4178BB5284CE', function(){ | ||
assert.equal(amTest.hash, '02D8FCAA86A958EE07385C12DCDB4178BB5284CE'); | ||
}); | ||
it('its manual hash should be B913193383A3BF119A28CA40A664531922DE2ADC', function(){ | ||
assert.equal(sha1(amTest.getRaw()).toUpperCase(), 'B913193383A3BF119A28CA40A664531922DE2ADC'); | ||
it('its manual hash should be 02D8FCAA86A958EE07385C12DCDB4178BB5284CE', function(){ | ||
assert.equal(sha1(amTest.getRaw()).toUpperCase(), '02D8FCAA86A958EE07385C12DCDB4178BB5284CE'); | ||
}); | ||
@@ -100,0 +92,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
560209
13576