Skip to content

Commit 5d73d76

Browse files
Remove tests
1 parent 323b01e commit 5d73d76

File tree

8 files changed

+18
-124
lines changed

8 files changed

+18
-124
lines changed

packages/firestore/.idea/runConfigurations/Unit_Tests__w__Mock_Persistence_.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/firestore/src/core/query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ function queryMatchesBounds(query: Query, doc: Document): boolean {
527527
}
528528

529529
/** Returns the collection group that this query targets. */
530-
export function queryGetCollectionGroup(query: Query): string {
530+
export function queryCollectionGroup(query: Query): string {
531531
return (
532532
query.collectionGroup ||
533533
(query.path.length % 2 === 1

packages/firestore/src/core/sync_engine_impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ import {
9292
newQueryForPath,
9393
Query,
9494
queryEquals,
95-
queryGetCollectionGroup,
95+
queryCollectionGroup,
9696
queryToTarget,
9797
stringifyQuery
9898
} from './query';
@@ -1443,7 +1443,7 @@ export async function syncEngineApplyTargetState(
14431443
case 'not-current': {
14441444
const changes = await localStoreGetNewDocumentChanges(
14451445
syncEngineImpl.localStore,
1446-
queryGetCollectionGroup(query[0])
1446+
queryCollectionGroup(query[0])
14471447
);
14481448
const synthesizedRemoteEvent =
14491449
RemoteEvent.createSynthesizedRemoteEventForCurrentChange(

packages/firestore/src/local/local_store_impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { BundleConverter, BundledDocuments, NamedQuery } from '../core/bundle';
2020
import {
2121
newQueryForPath,
2222
Query,
23-
queryGetCollectionGroup,
23+
queryCollectionGroup,
2424
queryToTarget
2525
} from '../core/query';
2626
import { SnapshotVersion } from '../core/snapshot_version';
@@ -1010,7 +1010,7 @@ export function localStoreExecuteQuery(
10101010
)
10111011
.next(documents => {
10121012
localStoreImpl.collectionGroupReatTime.set(
1013-
queryGetCollectionGroup(query),
1013+
queryCollectionGroup(query),
10141014
getMaxReadTime(documents)
10151015
);
10161016
return { documents, remoteKeys };

packages/firestore/test/unit/core/query.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ import {
3434
queryToTarget,
3535
QueryImpl,
3636
queryEquals,
37-
matchesAllDocuments
37+
matchesAllDocuments,
38+
queryCollectionGroup,
39+
newQueryForCollectionGroup
3840
} from '../../../src/core/query';
3941
import {
4042
Bound,
@@ -89,6 +91,14 @@ describe('Bound', () => {
8991
describe('Query', () => {
9092
addEqualityMatcher({ equalsFn: queryEquals, forType: QueryImpl });
9193

94+
it('can get collection group', () => {
95+
expect(queryCollectionGroup(query('foo'))).to.equal('foo');
96+
expect(queryCollectionGroup(query('foo/bar'))).to.equal('foo');
97+
expect(queryCollectionGroup(newQueryForCollectionGroup('foo'))).to.equal(
98+
'foo'
99+
);
100+
});
101+
92102
it('matches based on document key', () => {
93103
const queryKey = new ResourcePath(['rooms', 'eros', 'messages', '1']);
94104
const doc1 = doc('rooms/eros/messages/1', 0, { text: 'msg1' });

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

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ import {
6161
DbRemoteDocumentGlobalKey,
6262
DbRemoteDocumentGlobalStore,
6363
DbRemoteDocumentKey,
64-
DbRemoteDocumentReadTimeIndex,
6564
DbRemoteDocumentStore,
6665
DbTargetDocumentKey,
6766
DbTargetDocumentStore,
@@ -1029,41 +1028,6 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
10291028
});
10301029
});
10311030

1032-
it('can get recent document changes', async function (this: Context) {
1033-
const oldDocPaths = ['coll1/old', 'coll2/old'];
1034-
const newDocPaths = ['coll1/new', 'coll2/new'];
1035-
1036-
await withDb(13, db => {
1037-
return db.runTransaction(
1038-
this.test!.fullTitle(),
1039-
'readwrite',
1040-
V13_STORES,
1041-
txn => {
1042-
return addDocs(txn, oldDocPaths, /* version= */ 1).next(() =>
1043-
addDocs(txn, newDocPaths, /* version= */ 2).next(() => {
1044-
const remoteDocumentStore = txn.store<
1045-
DbRemoteDocumentKey,
1046-
DbRemoteDocument
1047-
>(DbRemoteDocumentStore);
1048-
1049-
const lastReadTime = toDbTimestampKey(version(1));
1050-
const range = IDBKeyRange.lowerBound(lastReadTime, true);
1051-
return remoteDocumentStore
1052-
.loadAll(DbRemoteDocumentReadTimeIndex, range)
1053-
.next(docsRead => {
1054-
const keys = docsRead.map(dbDoc => dbDoc.document!.name);
1055-
expect(keys).to.have.members([
1056-
'projects/test-project/databases/(default)/documents/coll1/new',
1057-
'projects/test-project/databases/(default)/documents/coll2/new'
1058-
]);
1059-
});
1060-
})
1061-
);
1062-
}
1063-
);
1064-
});
1065-
});
1066-
10671031
it('can upgrade from version 11 to 12', async () => {
10681032
await withDb(11, async () => {});
10691033
await withDb(12, async (db, version, objectStores) => {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import {
5151
localStoreReleaseTarget,
5252
localStoreSaveBundle,
5353
localStoreSaveNamedQuery,
54-
localStoreSynchronizeLastDocumentChangeReadTime,
5554
newLocalStore
5655
} from '../../../src/local/local_store_impl';
5756
import { LocalViewChanges } from '../../../src/local/local_view_changes';
@@ -579,7 +578,6 @@ describe('LocalStore w/ IndexedDB Persistence', () => {
579578
User.UNAUTHENTICATED,
580579
JSON_SERIALIZER
581580
);
582-
await localStoreSynchronizeLastDocumentChangeReadTime(localStore);
583581
return { queryEngine, persistence, localStore };
584582
}
585583

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

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
import { expect } from 'chai';
1919

2020
import { User } from '../../../src/auth/user';
21-
import { SnapshotVersion } from '../../../src/core/snapshot_version';
2221
import { IndexedDbPersistence } from '../../../src/local/indexeddb_persistence';
23-
import { remoteDocumentCacheGetLastReadTime } from '../../../src/local/indexeddb_remote_document_cache';
2422
import { documentKeySet, DocumentMap } from '../../../src/model/collections';
2523
import { MutableDocument, Document } from '../../../src/model/document';
2624
import {
@@ -36,7 +34,6 @@ import {
3634
field,
3735
key,
3836
path,
39-
removedDoc,
4037
version,
4138
wrap
4239
} from '../../util/helpers';
@@ -109,81 +106,6 @@ describe('IndexedDbRemoteDocumentCache', () => {
109106
await persistenceHelpers.clearTestPersistence();
110107
});
111108

112-
function getLastReadTime(): Promise<SnapshotVersion> {
113-
return persistence.runTransaction('getLastReadTime', 'readonly', txn => {
114-
return remoteDocumentCacheGetLastReadTime(txn);
115-
});
116-
}
117-
118-
it('skips previous changes', async () => {
119-
// Add a document to simulate a previous run.
120-
await cache.addEntries([doc('a/1', 1, DOC_DATA).setReadTime(version(1))]);
121-
await persistence.shutdown();
122-
123-
// Start a new run of the persistence layer
124-
persistence = await persistenceHelpers.testIndexedDbPersistence({
125-
synchronizeTabs: true,
126-
dontPurgeData: true
127-
});
128-
cache = new TestRemoteDocumentCache(persistence);
129-
const readTime = await getLastReadTime();
130-
const { changedDocs } = await cache.getNewDocumentChanges(readTime);
131-
assertMatches([], changedDocs);
132-
});
133-
134-
it('can get changes', async () => {
135-
await cache.addEntries([
136-
doc('a/1', 1, DOC_DATA),
137-
doc('b/1', 2, DOC_DATA),
138-
doc('b/2', 2, DOC_DATA),
139-
doc('a/1', 3, DOC_DATA)
140-
]);
141-
142-
let { changedDocs, readTime } = await cache.getNewDocumentChanges(
143-
SnapshotVersion.min()
144-
);
145-
assertMatches(
146-
[
147-
doc('a/1', 3, DOC_DATA),
148-
doc('b/1', 2, DOC_DATA),
149-
doc('b/2', 2, DOC_DATA)
150-
],
151-
changedDocs
152-
);
153-
154-
await cache.addEntry(doc('c/1', 4, DOC_DATA));
155-
changedDocs = (await cache.getNewDocumentChanges(readTime)).changedDocs;
156-
assertMatches([doc('c/1', 4, DOC_DATA)], changedDocs);
157-
});
158-
159-
it('can get empty changes', async () => {
160-
const { changedDocs } = await cache.getNewDocumentChanges(
161-
SnapshotVersion.min()
162-
);
163-
assertMatches([], changedDocs);
164-
});
165-
166-
it('can get missing documents in changes', async () => {
167-
await cache.addEntries([
168-
doc('a/1', 1, DOC_DATA),
169-
doc('a/2', 2, DOC_DATA),
170-
doc('a/3', 3, DOC_DATA)
171-
]);
172-
await cache.removeEntry(key('a/2'), version(4));
173-
174-
const { changedDocs } = await cache.getNewDocumentChanges(
175-
SnapshotVersion.min()
176-
);
177-
assertMatches(
178-
[
179-
doc('a/1', 1, DOC_DATA),
180-
removedDoc('a/2').setReadTime(version(4)),
181-
doc('a/3', 3, DOC_DATA)
182-
],
183-
changedDocs
184-
);
185-
});
186-
187109
it('can get next documents from collection group', async () => {
188110
await cache.addEntries([
189111
doc('a/1', 1, DOC_DATA),

0 commit comments

Comments
 (0)