Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIN should call VersionedData constructor #441

Merged
merged 2 commits into from Jul 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/SIN.js
Expand Up @@ -6,8 +6,10 @@ function SIN(type, payload) {
if (typeof type != 'number') {
SIN.super_.call(this, type, payload);
return;
};
}
this.data = new Buffer(1 + 1 + payload.length);
this.converters = this.encodings['binary'].converters;
this._encoding = this.encodings['binary']._encoding;
this.encoding('binary');
this.prefix(0x0F); // SIN magic number, in numberspace
this.type(type);
Expand Down
8 changes: 8 additions & 0 deletions test/test.SIN.js
Expand Up @@ -33,6 +33,14 @@ describe('SIN', function() {
s.should.equal(a.toString()); // check that validation doesn't change data
});
});

describe('#SIN', function() {
it('should be able to create a new SIN with a version byte', function() {
var myhash = bitcore.util.sha256ripe160('test');
var sin = new SIN(SIN.SIN_EPHEM, myhash);
should.exist(sin);
});
});
});


Expand Down
16 changes: 10 additions & 6 deletions test/test.SINKey.js
Expand Up @@ -4,16 +4,11 @@ var chai = chai || require('chai');
var bitcore = bitcore || require('../bitcore');
var should = chai.should();

var SINKeyModule = bitcore.SINKey;
var SINKey;
var SINKey = bitcore.SINKey;


describe('SINKey', function() {
it('should initialze the main object', function() {
should.exist(SINKeyModule);
});
it('should be able to create class', function() {
SINKey = SINKeyModule;
should.exist(SINKey);
});
it('should be able to create instance', function() {
Expand All @@ -24,4 +19,13 @@ describe('SINKey', function() {
should.exist(sk.privKey.public);
should.exist(sk.privKey.compressed);
});

describe('#storeObj', function() {
it('should give an object', function() {
var sinkey = new SINKey();
sinkey.generate();
var obj = sinkey.storeObj();
should.exist(obj);
});
});
});