Skip to content

Commit 832337d

Browse files
committed
Pretty
1 parent a603df6 commit 832337d

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

packages/firestore/test/unit/local/simple_db.test.ts

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -535,68 +535,68 @@ describe('SimpleDb', () => {
535535
// eslint-disable-next-line no-restricted-properties
536536
(isIndexedDbMock() ? it.skip : it)(
537537
'correctly sorts keys with nested arrays',
538-
async function (this: Context
539-
){
540-
// This test verifies that the sorting in IndexedDb matches
541-
// `dbKeyComparator()`
542-
543-
const keys = [
544-
'a/a/a/a/a/a/a/a/a/a',
545-
'a/b/a/a/a/a/a/a/a/b',
546-
'b/a/a/a/a/a/a/a/a/a',
547-
'b/b/a/a/a/a/a/a/a/b',
548-
'b/b/a/a/a/a/a/a',
549-
'b/b/b/a/a/a/a/b',
550-
'c/c/a/a/a/a',
551-
'd/d/a/a',
552-
'e/e'
553-
].map(k => DocumentKey.fromPath(k));
554-
555-
interface ValueType {
556-
prefixPath: string[];
557-
collectionId: string;
558-
documentId: string;
559-
}
560-
561-
const expectedOrder = [...keys];
562-
expectedOrder.sort(dbKeyComparator);
538+
async function (this: Context) {
539+
// This test verifies that the sorting in IndexedDb matches
540+
// `dbKeyComparator()`
541+
542+
const keys = [
543+
'a/a/a/a/a/a/a/a/a/a',
544+
'a/b/a/a/a/a/a/a/a/b',
545+
'b/a/a/a/a/a/a/a/a/a',
546+
'b/b/a/a/a/a/a/a/a/b',
547+
'b/b/a/a/a/a/a/a',
548+
'b/b/b/a/a/a/a/b',
549+
'c/c/a/a/a/a',
550+
'd/d/a/a',
551+
'e/e'
552+
].map(k => DocumentKey.fromPath(k));
553+
554+
interface ValueType {
555+
prefixPath: string[];
556+
collectionId: string;
557+
documentId: string;
558+
}
563559

564-
const actualOrder = await db.runTransaction(
565-
this.test!.fullTitle(),
566-
'readwrite',
567-
['docs'],
568-
txn => {
569-
const store = txn.store<string[], ValueType>('docs');
570-
571-
const writes = keys.map(k => {
572-
const path = k.path.toArray();
573-
return store.put(k.path.toArray(), {
574-
prefixPath: path.slice(0, path.length - 2),
575-
collectionId: path[path.length - 2],
576-
documentId: path[path.length - 1]
560+
const expectedOrder = [...keys];
561+
expectedOrder.sort(dbKeyComparator);
562+
563+
const actualOrder = await db.runTransaction(
564+
this.test!.fullTitle(),
565+
'readwrite',
566+
['docs'],
567+
txn => {
568+
const store = txn.store<string[], ValueType>('docs');
569+
570+
const writes = keys.map(k => {
571+
const path = k.path.toArray();
572+
return store.put(k.path.toArray(), {
573+
prefixPath: path.slice(0, path.length - 2),
574+
collectionId: path[path.length - 2],
575+
documentId: path[path.length - 1]
576+
});
577577
});
578-
});
579578

580-
return PersistencePromise.waitFor(writes).next(() =>
581-
store
582-
.loadAll('path')
583-
.next(keys =>
584-
keys.map(k =>
585-
DocumentKey.fromSegments([
586-
...k.prefixPath,
587-
k.collectionId,
588-
k.documentId
589-
])
579+
return PersistencePromise.waitFor(writes).next(() =>
580+
store
581+
.loadAll('path')
582+
.next(keys =>
583+
keys.map(k =>
584+
DocumentKey.fromSegments([
585+
...k.prefixPath,
586+
k.collectionId,
587+
k.documentId
588+
])
589+
)
590590
)
591-
)
592-
);
593-
}
594-
);
591+
);
592+
}
593+
);
595594

596-
expect(actualOrder.map(k => k.toString())).to.deep.equal(
597-
expectedOrder.map(k => k.toString())
598-
);
599-
});
595+
expect(actualOrder.map(k => k.toString())).to.deep.equal(
596+
expectedOrder.map(k => k.toString())
597+
);
598+
}
599+
);
600600

601601
it('retries transactions', async function (this: Context) {
602602
let attemptCount = 0;

0 commit comments

Comments
 (0)