fix browser tests for Point and Key

The addUncompressed function is for node-only, and is a temporary workaround
until we expose a better crypto interface in both node and the browser. I wrote
tests for this function that were node-only, but were broken in the browser.  I
also wrote tests for the Point class that should have worked in both node and
the browser, and did, but I was using the wrong module such that it worked only
in node.  This update makes the tests work in the browser by using the correct
module.
This commit is contained in:
Ryan X. Charles 2014-03-31 16:32:16 -04:00
parent 93050e3e92
commit 4f5b41eff0
3 changed files with 53 additions and 48 deletions

View File

@ -28,6 +28,7 @@
<script src="test.Opcode.js"></script>
<script src="test.Peer.js"></script>
<script src="test.PeerManager.js"></script>
<script src="test.Point.js"></script>
<script src="test.PrivateKey.js"></script>
<script src="test.RpcClient.js"></script>
<script src="test.Script.js"></script>

View File

@ -1,12 +1,11 @@
'use strict';
var assert = require('assert');
var chai = chai || require('chai');
var bitcore = bitcore || require('../bitcore');
var coinUtil = coinUtil || require('../util/util');
var coinUtil = coinUtil || bitcore.util;
var buffertools = require('buffertools');
var should = chai.should();
var assert = chai.assert;
var Key = bitcore.Key;
describe('Key', function() {
@ -115,6 +114,10 @@ describe('Key', function() {
ret.should.equal(false);
});
//node tests only
//addUncompressed is a node-only interface feature
if (typeof process !== 'undefined' && process.versions) {
describe('#addUncompressed', function() {
it('should exist', function() {
should.exist(Key.addUncompressed);
@ -162,5 +165,6 @@ describe('Key', function() {
});
});
}
});

View File

@ -1,13 +1,13 @@
'use strict';
var assert = require('assert');
var chai = chai || require('chai');
var bitcore = bitcore || require('../bitcore');
var coinUtil = coinUtil || require('../util/util');
var coinUtil = coinUtil || bitcore.util;
var buffertools = require('buffertools');
var bignum = require('bignum');
var should = chai.should();
var assert = chai.assert;
var Point = bitcore.Point;
var Key = bitcore.Key;