Skip to content

Commit 9653bdc

Browse files
committed
rename unit test
1 parent 48a5d6a commit 9653bdc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/firestore/src/util/misc.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,17 @@ export function compareUtf8Strings(left: string, right: string): number {
8989
// Lazy instantiate TextEncoder
9090
const encoder = newTextEncoder();
9191

92+
// Substring and do UTF-8 encoded byte comparison
9293
const leftBytes = encoder.encode(getUtf8SafeSubstring(left, i));
9394
const rightBytes = encoder.encode(getUtf8SafeSubstring(right, i));
9495
for (
9596
let j = 0;
9697
j < Math.min(leftBytes.length, rightBytes.length);
9798
j++
9899
) {
99-
const comparison = primitiveComparator(leftBytes[j], rightBytes[j]);
100-
if (comparison !== 0) {
101-
return comparison;
100+
const comp = primitiveComparator(leftBytes[j], rightBytes[j]);
101+
if (comp !== 0) {
102+
return comp;
102103
}
103104
}
104105
}

packages/firestore/test/unit/util/misc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class StringBuilder {
267267
}
268268

269269
describe('CompareUtf8Strings', () => {
270-
it('testCompareUtf8Strings', () => {
270+
it('compareUtf8Strings should return correct results', () => {
271271
const errors = [];
272272
const seed = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
273273
let passCount = 0;

0 commit comments

Comments
 (0)