Wallet/test/test.network.WebRTC.js

40 lines
1 KiB
JavaScript
Raw Normal View History

'use strict';
var chai = chai || require('chai');
var should = chai.should();
var expect = chai.expect;
var sinon = sinon || require('sinon');
var bitcore = bitcore || require('bitcore');
2014-06-16 14:41:33 -07:00
var WebRTC = require('../js/models/network/WebRTC');
describe('Network / WebRTC', function() {
it('should create an instance', function () {
2014-06-16 14:41:33 -07:00
var n = new WebRTC();
should.exist(n);
});
2014-06-16 14:41:33 -07:00
describe('#WebRTC constructor', function() {
it('should set reconnect attempts', function() {
var n = new WebRTC();
n.reconnectAttempts.should.equal(3);
});
it('should call cleanUp', function() {
2014-06-16 14:41:33 -07:00
var save = WebRTC.prototype.cleanUp;
WebRTC.prototype.cleanUp = sinon.spy();
var n = new WebRTC();
n.cleanUp.calledOnce.should.equal(true);
2014-06-16 14:41:33 -07:00
WebRTC.prototype.cleanUp = save;
});
});
describe('#cleanUp', function() {
it('should set privkey to null', function() {
2014-06-16 14:41:33 -07:00
var n = new WebRTC();
n.cleanUp();
expect(n.privkey).to.equal(null);
});
});
});