Skip to content

Commit 0b5c3c5

Browse files
committed
update the test docs
1 parent 99c2c35 commit 0b5c3c5

File tree

1 file changed

+40
-45
lines changed

1 file changed

+40
-45
lines changed

packages/firestore/test/lite/integration.test.ts

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,29 +2047,15 @@ describe('withConverter() support', () => {
20472047
});
20482048

20492049
describe('countQuery()', () => {
2050-
const converter = {
2051-
toFirestore(input: { id: string; content: string }): DocumentData {
2052-
return { key: input.id, value: input.content };
2053-
},
2054-
fromFirestore(snapshot: QueryDocumentSnapshot): {
2055-
id: string;
2056-
content: string;
2057-
} {
2058-
const data = snapshot.data();
2059-
return { content: data.value, id: data.documentId };
2060-
}
2061-
};
2062-
20632050
const testDocs = [
2064-
{ key: 'a', value: 'Adam' },
2065-
{ key: 'b', value: 'Bob' },
2066-
{ key: 'c', value: 'Chris' },
2067-
{ key: 'a', value: 'Anna' },
2068-
{ key: 'b', value: 'Bill' },
2069-
{ key: 'c', value: 'Cooper' }
2051+
{ author: 'authorA', title: 'titleA' },
2052+
{ author: 'authorA', title: 'titleB' },
2053+
{ author: 'authorB', title: 'titleC' },
2054+
{ author: 'authorB', title: 'titleD' },
2055+
{ author: 'authorB', title: 'titleE' }
20702056
];
20712057

2072-
it.only('AggregateQuery and AggregateQuerySnapshot inherits the original query', () => {
2058+
it('AggregateQuery and AggregateQuerySnapshot inherits the original query', () => {
20732059
return withTestCollection(async coll => {
20742060
const query_ = query(coll);
20752061

@@ -2082,7 +2068,7 @@ describe('countQuery()', () => {
20822068
});
20832069
});
20842070

2085-
it.only('empty collection count equals to 0', () => {
2071+
it('empty test collection count', () => {
20862072
return withTestCollection(async coll => {
20872073
const countQuery_ = countQuery(query(coll));
20882074

@@ -2091,76 +2077,85 @@ describe('countQuery()', () => {
20912077
});
20922078
});
20932079

2094-
it.only('test collection count equals to 6', () => {
2080+
it('test collection count with sample docs ', () => {
20952081
return withTestCollectionAndInitialData(testDocs, async collection => {
20962082
const countQuery_ = countQuery(query(collection));
20972083
const snapshot = await getAggregateFromServerDirect(countQuery_);
2098-
expect(snapshot.getCount()).to.equal(6);
2084+
expect(snapshot.getCount()).to.equal(5);
20992085
});
21002086
});
21012087

2102-
it.only('test collection count with filter', () => {
2088+
it('test collection count with filter', () => {
21032089
return withTestCollectionAndInitialData(testDocs, async collection => {
2104-
const query_ = query(collection, where('key', '==', 'a'));
2090+
const query_ = query(collection, where('author', '==', 'authorA'));
21052091
const countQuery_ = countQuery(query_);
21062092
const snapshot = await getAggregateFromServerDirect(countQuery_);
21072093
expect(snapshot.getCount()).to.equal(2);
21082094
});
21092095
});
21102096

2111-
it.only('test collection count with filter and a small limit size', () => {
2097+
it('test collection count with filter and a small limit size', () => {
21122098
return withTestCollectionAndInitialData(testDocs, async collection => {
2113-
const query_ = query(collection, where('key', '==', 'a'), limit(1));
2099+
const query_ = query(
2100+
collection,
2101+
where('author', '==', 'authorA'),
2102+
limit(1)
2103+
);
21142104
const countQuery_ = countQuery(query_);
21152105
const snapshot = await getAggregateFromServerDirect(countQuery_);
21162106
expect(snapshot.getCount()).to.equal(1);
21172107
});
21182108
});
21192109

2120-
it.only('test collection count with filter and a large limit size', () => {
2110+
it('test collection count with filter and a large limit size', () => {
21212111
return withTestCollectionAndInitialData(testDocs, async collection => {
2122-
const query_ = query(collection, where('key', '==', 'a'), limit(3));
2112+
const query_ = query(
2113+
collection,
2114+
where('author', '==', 'authorA'),
2115+
limit(3)
2116+
);
21232117
const countQuery_ = countQuery(query_);
21242118
const snapshot = await getAggregateFromServerDirect(countQuery_);
21252119
expect(snapshot.getCount()).to.equal(2);
21262120
});
21272121
});
21282122

2129-
it.only('test collection count with converter on query', () => {
2123+
it('test collection count with converter on query', () => {
21302124
return withTestCollectionAndInitialData(testDocs, async collection => {
2131-
const query_ = query(collection, where('key', '==', 'a')).withConverter(
2132-
converter
2133-
);
2125+
const query_ = query(
2126+
collection,
2127+
where('author', '==', 'authorA')
2128+
).withConverter(postConverter);
21342129
const countQuery_ = countQuery(query_);
21352130
const snapshot = await getAggregateFromServerDirect(countQuery_);
21362131
expect(snapshot.getCount()).to.equal(2);
21372132
});
21382133
});
21392134

2140-
it.only('aggregateQueryEqual returns true on same queries', () => {
2135+
it('aggregateQueryEqual returns true on same queries', () => {
21412136
return withTestCollectionAndInitialData(testDocs, async collection => {
2142-
const query1 = query(collection, where('key', '==', 'a'));
2143-
const query2 = query(collection, where('key', '==', 'a'));
2137+
const query1 = query(collection, where('author', '==', 'authorA'));
2138+
const query2 = query(collection, where('author', '==', 'authorA'));
21442139
const countQuery1 = countQuery(query1);
21452140
const countQuery2 = countQuery(query2);
21462141
expect(aggregateQueryEqual(countQuery1, countQuery2)).to.be.true;
21472142
});
21482143
});
21492144

2150-
it.only('aggregateQueryEqual returns false on different queries', () => {
2145+
it('aggregateQueryEqual returns false on different queries', () => {
21512146
return withTestCollectionAndInitialData(testDocs, async collection => {
2152-
const query1 = query(collection, where('key', '==', 'a'));
2153-
const query2 = query(collection, where('key', '!=', 'a'));
2147+
const query1 = query(collection, where('author', '==', 'authorA'));
2148+
const query2 = query(collection, where('author', '==', 'authorB'));
21542149
const countQuery1 = countQuery(query1);
21552150
const countQuery2 = countQuery(query2);
21562151
expect(aggregateQueryEqual(countQuery1, countQuery2)).to.be.false;
21572152
});
21582153
});
21592154

2160-
it.only('aggregateQuerySnapshotEqual returns true on same queries', () => {
2155+
it('aggregateQuerySnapshotEqual returns true on same queries', () => {
21612156
return withTestCollectionAndInitialData(testDocs, async collection => {
2162-
const query1 = query(collection, where('key', '==', 'a'));
2163-
const query2 = query(collection, where('key', '==', 'a'));
2157+
const query1 = query(collection, where('author', '==', 'authorA'));
2158+
const query2 = query(collection, where('author', '==', 'authorA'));
21642159
const countQuery1A = countQuery(query1);
21652160
const countQuery1B = countQuery(query1);
21662161
const countQuery2 = countQuery(query2);
@@ -2172,10 +2167,10 @@ describe('countQuery()', () => {
21722167
});
21732168
});
21742169

2175-
it.only('aggregateQuerySnapshotEqual returns false on different queries', () => {
2170+
it('aggregateQuerySnapshotEqual returns false on different queries', () => {
21762171
return withTestCollectionAndInitialData(testDocs, async collection => {
2177-
const query1 = query(collection, where('key', '==', 'a'));
2178-
const query2 = query(collection, where('key', '==', 'b'));
2172+
const query1 = query(collection, where('author', '==', 'authorA'));
2173+
const query2 = query(collection, where('author', '==', 'authorB'));
21792174
const countQuery1 = countQuery(query1);
21802175
const countQuery2 = countQuery(query2);
21812176
const snapshot1 = await getAggregateFromServerDirect(countQuery1);

0 commit comments

Comments
 (0)