Skip to content

Commit

Permalink
tests: ignore instance id when comparing connection key
Browse files Browse the repository at this point in the history
  • Loading branch information
amnonbc committed Sep 29, 2024
1 parent 8c9ce8b commit a478049
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/browser/connection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,19 @@ define(['shared_helper', 'chai'], function (Helper, chai) {
});
});

function connectionID(key) {
const s = key.split('-')[0];
if (s.includes('!')) {
/* skip the instance id */
return s.split('!')[1];
}
return s;
}

/* uses internal realtime knowledge of the format of the connection key to
* check if a connection key is the result of a successful recovery of another */
function sameConnection(keyA, keyB) {
return keyA.split('-')[0] === keyB.split('-')[0];
return connectionID(keyA) === connectionID(keyB);
}

/**
Expand Down

0 comments on commit a478049

Please sign in to comment.