mirror of https://github.com/BTCPrivate/copay.git
make WebRTC tests work
This commit is contained in:
parent
434dad831d
commit
8bba982978
|
@ -1,3 +1,4 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var imports = require('soop').imports();
|
var imports = require('soop').imports();
|
||||||
var EventEmitter= imports.EventEmitter || require('events').EventEmitter;
|
var EventEmitter= imports.EventEmitter || require('events').EventEmitter;
|
||||||
|
|
|
@ -5,34 +5,41 @@ var should = chai.should();
|
||||||
var expect = chai.expect;
|
var expect = chai.expect;
|
||||||
var sinon = sinon || require('sinon');
|
var sinon = sinon || require('sinon');
|
||||||
var bitcore = bitcore || require('bitcore');
|
var bitcore = bitcore || require('bitcore');
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
var Network = copay.WebRTC || require('../js/models/network/WebRTC.js');
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
|
var WebRTC = require('../js/models/network/WebRTC');
|
||||||
|
|
||||||
describe('Network / WebRTC', function() {
|
describe('Network / WebRTC', function() {
|
||||||
|
|
||||||
it('should create an instance', function () {
|
it('should create an instance', function () {
|
||||||
var n = new Network();
|
var n = new WebRTC();
|
||||||
should.exist(n);
|
should.exist(n);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
describe('#WebRTC constructor', function() {
|
||||||
describe('#Network constructor', function() {
|
it('should set reconnect attempts', function() {
|
||||||
|
var n = new WebRTC();
|
||||||
|
n.reconnectAttempts.should.equal(3);
|
||||||
|
});
|
||||||
|
|
||||||
it('should call cleanUp', function() {
|
it('should call cleanUp', function() {
|
||||||
var save = Network.prototype.cleanUp;
|
var save = WebRTC.prototype.cleanUp;
|
||||||
Network.prototype.cleanUp = sinon.spy();
|
WebRTC.prototype.cleanUp = sinon.spy();
|
||||||
var n = new Network();
|
var n = new WebRTC();
|
||||||
n.cleanUp.calledOnce.should.equal(true);
|
n.cleanUp.calledOnce.should.equal(true);
|
||||||
Network.prototype.cleanUp = save;
|
WebRTC.prototype.cleanUp = save;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#cleanUp', function() {
|
describe('#cleanUp', function() {
|
||||||
it('should set privkey to null', function() {
|
it('should set privkey to null', function() {
|
||||||
var n = new Network();
|
var n = new WebRTC();
|
||||||
n.cleanUp();
|
n.cleanUp();
|
||||||
expect(n.privkey).to.equal(null);
|
expect(n.privkey).to.equal(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue