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:
parent
93050e3e92
commit
4f5b41eff0
@ -28,6 +28,7 @@
|
|||||||
<script src="test.Opcode.js"></script>
|
<script src="test.Opcode.js"></script>
|
||||||
<script src="test.Peer.js"></script>
|
<script src="test.Peer.js"></script>
|
||||||
<script src="test.PeerManager.js"></script>
|
<script src="test.PeerManager.js"></script>
|
||||||
|
<script src="test.Point.js"></script>
|
||||||
<script src="test.PrivateKey.js"></script>
|
<script src="test.PrivateKey.js"></script>
|
||||||
<script src="test.RpcClient.js"></script>
|
<script src="test.RpcClient.js"></script>
|
||||||
<script src="test.Script.js"></script>
|
<script src="test.Script.js"></script>
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var assert = require('assert');
|
|
||||||
var chai = chai || require('chai');
|
var chai = chai || require('chai');
|
||||||
var bitcore = bitcore || require('../bitcore');
|
var bitcore = bitcore || require('../bitcore');
|
||||||
var coinUtil = coinUtil || require('../util/util');
|
var coinUtil = coinUtil || bitcore.util;
|
||||||
var buffertools = require('buffertools');
|
var buffertools = require('buffertools');
|
||||||
|
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
|
var assert = chai.assert;
|
||||||
|
|
||||||
var Key = bitcore.Key;
|
var Key = bitcore.Key;
|
||||||
describe('Key', function() {
|
describe('Key', function() {
|
||||||
@ -115,6 +114,10 @@ describe('Key', function() {
|
|||||||
ret.should.equal(false);
|
ret.should.equal(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//node tests only
|
||||||
|
//addUncompressed is a node-only interface feature
|
||||||
|
if (typeof process !== 'undefined' && process.versions) {
|
||||||
describe('#addUncompressed', function() {
|
describe('#addUncompressed', function() {
|
||||||
it('should exist', function() {
|
it('should exist', function() {
|
||||||
should.exist(Key.addUncompressed);
|
should.exist(Key.addUncompressed);
|
||||||
@ -162,5 +165,6 @@ describe('Key', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var assert = require('assert');
|
|
||||||
var chai = chai || require('chai');
|
var chai = chai || require('chai');
|
||||||
var bitcore = bitcore || require('../bitcore');
|
var bitcore = bitcore || require('../bitcore');
|
||||||
var coinUtil = coinUtil || require('../util/util');
|
var coinUtil = coinUtil || bitcore.util;
|
||||||
var buffertools = require('buffertools');
|
var buffertools = require('buffertools');
|
||||||
var bignum = require('bignum');
|
var bignum = require('bignum');
|
||||||
|
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
|
var assert = chai.assert;
|
||||||
|
|
||||||
var Point = bitcore.Point;
|
var Point = bitcore.Point;
|
||||||
var Key = bitcore.Key;
|
var Key = bitcore.Key;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user