webrtc-troubleshoot
Advanced tools
Comparing version 8.1.0 to 8.1.1
{ | ||
"name": "webrtc-troubleshoot", | ||
"version": "8.1.0", | ||
"version": "8.1.1", | ||
"description": "A way to add webrtc troubleshooting to your app", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -6,2 +6,3 @@ // adapted from https://github.com/webrtc/testrtc/blob/master/src/js/bandwidth_test.js | ||
import StatisticsAggregate from '../utils/StatisticsAggregate'; | ||
import ERROR_CODES from '../utils/testErrorCodes'; | ||
@@ -40,2 +41,3 @@ export default class AudioBandwidthTest extends Test { | ||
const error = new Error('No ice servers were provided'); | ||
error.pcCode = ERROR_CODES.ICE; | ||
error.details = this.log; | ||
@@ -59,2 +61,3 @@ return this.reject(error); | ||
.catch(err => { | ||
err.pcCode = ERROR_CODES.MEDIA; | ||
const results = this.getResults(); | ||
@@ -94,2 +97,3 @@ results.error = err; | ||
.catch(error => { | ||
error.pcCode = ERROR_CODES.MEDIA; | ||
this.addLog('error', {'status': 'fail', 'error': error}); | ||
@@ -96,0 +100,0 @@ this.addLog('error', `Failed to get access to local media due to error: ${error.name}`); |
@@ -14,3 +14,3 @@ import Test from '../utils/Test'; | ||
this.options.iceServers.forEach((iceServer) => { | ||
this.logger.log(`Using ICE Server: ${iceServer.url}`); | ||
this.logger.log(`Using ICE Server: ${iceServer.urls}`); | ||
}); | ||
@@ -27,2 +27,3 @@ if (this.options.iceServers.length === 0) { | ||
super.start(); | ||
this.logIceServers(); | ||
this.pc1 = new PeerConnection(this.options); | ||
@@ -29,0 +30,0 @@ this.pc2 = new PeerConnection(this.options); |
@@ -6,2 +6,3 @@ // adapted from https://github.com/webrtc/testrtc/blob/master/src/js/bandwidth_test.js | ||
import StatisticsAggregate from '../utils/StatisticsAggregate'; | ||
import ERROR_CODES from '../utils/testErrorCodes'; | ||
@@ -54,2 +55,3 @@ export default class VideoBandwidthTest extends Test { | ||
const error = new Error('No ice servers were provided'); | ||
error.pcCode = ERROR_CODES.ICE; | ||
error.details = this.log; | ||
@@ -82,2 +84,3 @@ return this.reject(error); | ||
}, (err) => { | ||
err.pcCode = ERROR_CODES.MEDIA; | ||
const results = this.getResults(); | ||
@@ -115,2 +118,3 @@ results.error = err; | ||
}, (error) => { | ||
error.pcCode = ERROR_CODES.MEDIA; | ||
this.addLog('error', {'status': 'fail', 'error': error}); | ||
@@ -117,0 +121,0 @@ this.addLog('error', `Failed to get access to local media due to error: ${error.name}`); |
@@ -13,2 +13,3 @@ import TestSuite from './utils/TestSuite'; | ||
import VideoFrameChecker from './utils/VideoFrameChecker'; | ||
import ERROR_CODES from './utils/testErrorCodes'; | ||
@@ -25,3 +26,4 @@ export default { | ||
AudioBandwidthTest, | ||
SymmetricNatTest | ||
SymmetricNatTest, | ||
ERROR_CODES | ||
}; |
@@ -53,40 +53,2 @@ import test from 'ava'; | ||
test('start() should create offer and return promise', t => { | ||
t.plan(0); | ||
// Mock out RTCPeerConnection for node runtime. | ||
global.RTCPeerConnection = function () { | ||
return { | ||
addEventListener: () => {}, | ||
addStream: () => {}, | ||
addTrack: () => {}, | ||
createOffer: sinon.stub().returns(Promise.resolve()), | ||
setLocalDescription: () => {}, | ||
setRemoteDescription: () => {}, | ||
createAnswer: () => Promise.resolve(), | ||
gatherStats: () => {}, | ||
getStats: () => { | ||
return { | ||
then: () => {} | ||
}; | ||
}, | ||
gotStats: () => {}, | ||
getRemoteStreams: () => {}, | ||
createDataChannel: () => { | ||
return { | ||
onmessage: null | ||
}; | ||
}, | ||
offer: () => {} | ||
}; | ||
}; | ||
const options = { | ||
logger: { | ||
log: sinon.stub() | ||
} | ||
}; | ||
connectivityTest = new ConnectivityTest(options); | ||
connectivityTest.start(); | ||
sinon.assert.calledOnce(connectivityTest.pc1.pc.createOffer); | ||
}); | ||
test('destroy() should close peer connection', t => { | ||
@@ -93,0 +55,0 @@ connectivityTest = new ConnectivityTest({}); |
42
485276
4136