Skip to content

Commit

Permalink
rename unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
milaGGL committed Feb 20, 2025
1 parent 48a5d6a commit 9653bdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/firestore/src/util/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,17 @@ export function compareUtf8Strings(left: string, right: string): number {
// Lazy instantiate TextEncoder
const encoder = newTextEncoder();

// Substring and do UTF-8 encoded byte comparison
const leftBytes = encoder.encode(getUtf8SafeSubstring(left, i));
const rightBytes = encoder.encode(getUtf8SafeSubstring(right, i));
for (
let j = 0;
j < Math.min(leftBytes.length, rightBytes.length);
j++
) {
const comparison = primitiveComparator(leftBytes[j], rightBytes[j]);
if (comparison !== 0) {
return comparison;
const comp = primitiveComparator(leftBytes[j], rightBytes[j]);
if (comp !== 0) {
return comp;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/test/unit/util/misc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class StringBuilder {
}

describe('CompareUtf8Strings', () => {
it('testCompareUtf8Strings', () => {
it('compareUtf8Strings should return correct results', () => {
const errors = [];
const seed = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
let passCount = 0;
Expand Down

0 comments on commit 9653bdc

Please sign in to comment.