Skip to content

Commit

Permalink
Merge pull request #4 from intuit/CandidateCheck
Browse files Browse the repository at this point in the history
Fixed the candidate check logic in getDeviceLocalIPAsString function
  • Loading branch information
skodamarthi authored Sep 25, 2020
2 parents 8ed7a47 + b7ec471 commit 3a198ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/js/common/browserInfoHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getDeviceLocalIPAsString = () => {
deviceIpString = ip.join(",");
resolve(deviceIpString);
}
if (event.candidate.candidate) {
else if (event.candidate.candidate) {
const candidateValues = event.candidate.candidate.split(" ");
if (candidateValues.length > ICE_CANDIDATE_IP_INDEX) {
ip.push(candidateValues[ICE_CANDIDATE_IP_INDEX]);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/common/browserInfoHelper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ describe("BrowserInfoHelper", () => {
throw new Error("Expected an error to be thrown, but it was not");
});

it("RTCPeerConnection throws unexpected error", async () => {
it("RTCPeerConnection throws CREATE_CONNECTION_ERROR", async() => {
webRtcConnectionStub.mockReturnValue(MockErrorRTCPeerConnection);
try {
await getDeviceLocalIPAsString();
} catch (error) {
expect(error.toString()).toEqual(
"Error: MockErrorRTCPeerConnection error thrown"
"CREATE_CONNECTION_ERROR"
);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/mock/MockRTCPeerConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class MockRTCPeerConnection {
}

export class MockErrorRTCPeerConnection extends MockRTCPeerConnection {
createDataChannel() {
throw new Error("MockErrorRTCPeerConnection error thrown");
createOffer() {
return Promise.reject();
}
}

0 comments on commit 3a198ca

Please sign in to comment.