bitcore/test/test.Address.js

37 lines
938 B
JavaScript
Raw Normal View History

2014-02-04 11:02:09 -08:00
'use strict';
var chai = require('chai');
var bitcore = require('../bitcore');
var should = chai.should();
2014-02-05 12:00:08 -08:00
var AddressModule = bitcore.Address;
var Address;
2014-02-04 11:02:09 -08:00
2014-02-05 13:14:00 -08:00
describe('Address', function() {
2014-02-04 11:02:09 -08:00
it('should initialze the main object', function() {
2014-02-05 12:00:08 -08:00
should.exist(AddressModule);
2014-02-04 11:02:09 -08:00
});
2014-02-05 12:00:08 -08:00
it('should be able to create class', function() {
Address = AddressModule;
2014-02-05 13:14:00 -08:00
should.exist(Address);
2014-02-04 11:02:09 -08:00
});
2014-02-06 07:57:47 -08:00
it('should be able to create instance', function() {
2014-02-05 13:14:00 -08:00
var a = new Address('1KfyjCgBSMsLqiCbakfSdeoBUqMqLUiu3T');
should.exist(a);
});
it('should validate correctly', function() {
2014-02-06 07:57:47 -08:00
var a = new Address('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa');
var m = new Address('32QBdjycLwbDTuGafUwaU5p5GxzSLPYoF6');
var b = new Address('11111111111111111111111111122222234');
2014-02-05 13:14:00 -08:00
a.validate.bind(a).should.not.throw(Error);
m.validate.bind(m).should.not.throw(Error);
b.validate.bind(b).should.throw(Error);
2014-02-04 11:02:09 -08:00
});
});