Browse Source

starting with Transaction class

patch-2
Manuel Araoz 11 years ago
parent
commit
e295e33800
  1. 6
      bitcore.js
  2. 2
      test/index.html
  3. 8
      test/test.Address.js
  4. 28
      test/test.Script.js
  5. 28
      test/test.Transaction.js
  6. 20
      test/test.misc.js

6
bitcore.js

@ -7,7 +7,11 @@ module.exports.bignum = require('bignum');
module.exports.base58 = require('base58-native');
module.exports.EncodedData = require('./util/EncodedData');
module.exports.VersionedData = require('./util/VersionedData');
module.exports.Address= require('./Address');
module.exports.Address = require('./Address');
module.exports.config = require('./config');
module.exports.log = require('./util/log');
//module.exports.Script = require('./Script');
//module.exports.Transaction = require('./Transaction');
if (typeof process.versions === 'undefined') {

2
test/index.html

@ -20,6 +20,8 @@
<script src="test.EncodedData.js"></script>
<script src="test.VersionedData.js"></script>
<script src="test.Address.js"></script>
<script src="test.Script.js"></script>
<script src="test.misc.js"></script>
<script>
mocha.run();
</script>

8
test/test.Address.js

@ -16,14 +16,14 @@ describe('Address', function() {
Address = AddressModule.class();
should.exist(Address);
});
it('should be able to create Address object', function() {
it('should be able to create instance', function() {
var a = new Address('1KfyjCgBSMsLqiCbakfSdeoBUqMqLUiu3T');
should.exist(a);
});
it('should validate correctly', function() {
var a = new Address("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa");
var m = new Address("32QBdjycLwbDTuGafUwaU5p5GxzSLPYoF6");
var b = new Address("11111111111111111111111111122222234");
var a = new Address('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa');
var m = new Address('32QBdjycLwbDTuGafUwaU5p5GxzSLPYoF6');
var b = new Address('11111111111111111111111111122222234');
a.validate.bind(a).should.not.throw(Error);
m.validate.bind(m).should.not.throw(Error);
b.validate.bind(b).should.throw(Error);

28
test/test.Script.js

@ -0,0 +1,28 @@
'use strict';
var chai = require('chai');
var bitcore = require('../bitcore');
var should = chai.should();
var ScriptModule = bitcore.Script;
var Script;
describe('Script', function() {
it('should initialze the main object', function() {
should.exist(ScriptModule);
});
it('should be able to create class', function() {
Script = ScriptModule.class();
should.exist(Script);
});
it('should be able to create instance', function() {
var s = new Script();
should.exist(s);
});
});

28
test/test.Transaction.js

@ -0,0 +1,28 @@
'use strict';
var chai = require('chai');
var bitcore = require('../bitcore');
var should = chai.should();
var TransactionModule = bitcore.Transaction;
var Transaction;
describe('Transaction', function() {
it('should initialze the main object', function() {
should.exist(TransactionModule);
});
it('should be able to create class', function() {
Transaction = TransactionModule.class();
should.exist(Transaction);
});
it('should be able to create instance', function() {
var t = new Transaction();
should.exist(t);
});
});

20
test/test.misc.js

@ -0,0 +1,20 @@
'use strict';
var chai = require('chai');
var bitcore = require('../bitcore');
var should = chai.should();
describe('Miscelaneous stuff', function() {
it('should initialze the config object', function() {
should.exist(bitcore.config);
});
it('should initialze the log object', function() {
should.exist(bitcore.log);
});
});
Loading…
Cancel
Save