Skip to content

Commit 10ee77e

Browse files
committed
reformat code
1 parent 2a3abd0 commit 10ee77e

File tree

4 files changed

+98
-99
lines changed

4 files changed

+98
-99
lines changed

packages/firestore/src/remote/datastore.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import { CredentialsProvider } from '../api/credentials';
1919
import { User } from '../auth/user';
2020
import { Query, queryToTarget } from '../core/query';
21-
import { AggregateSpec } from '../lite-api/aggregate';
2221
import { Document } from '../model/document';
2322
import { DocumentKey } from '../model/document_key';
2423
import { Mutation } from '../model/mutation';

packages/firestore/src/remote/serializer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import {
3535
Target
3636
} from '../core/target';
3737
import { TargetId } from '../core/types';
38-
import { AggregateSpec } from '../lite-api/aggregate';
3938
import { Timestamp } from '../lite-api/timestamp';
4039
import { TargetData, TargetPurpose } from '../local/target_data';
4140
import { MutableDocument } from '../model/document';
@@ -859,6 +858,7 @@ export function toRunAggregationQueryRequest(
859858
target: Target
860859
): ProtoRunAggregationQueryRequest {
861860
const queryTarget = toQueryTarget(serializer, target);
861+
862862
return {
863863
structuredAggregationQuery: {
864864
aggregations: [

packages/firestore/test/integration/api/aggregation.test.ts

Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -15,98 +15,98 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { expect } from 'chai';
18+
import { expect } from 'chai';
1919

20-
import {
21-
collection,
22-
collectionGroup,
23-
doc,
24-
disableNetwork,
25-
query,
26-
terminate,
27-
where,
28-
writeBatch,
29-
getCountFromServer
30-
} from '../util/firebase_export';
31-
import {
32-
apiDescribe,
33-
postConverter,
34-
withEmptyTestCollection,
35-
withTestCollection,
36-
withTestDb
37-
} from '../util/helpers';
38-
39-
apiDescribe('Count query', (persistence: boolean) => {
40-
it('can run count query getCountFromServer', () => {
41-
const testDocs = {
42-
a: { author: 'authorA', title: 'titleA' },
43-
b: { author: 'authorB', title: 'titleB' }
44-
};
45-
return withTestCollection(persistence, testDocs, async coll => {
46-
const snapshot = await getCountFromServer(coll);
47-
expect(snapshot.data().count).to.equal(2);
48-
});
49-
});
50-
51-
it('count query supports withConverter', () => {
52-
const testDocs = {
53-
a: { author: 'authorA', title: 'titleA' },
54-
b: { author: 'authorB', title: 'titleB' }
55-
};
56-
return withTestCollection(persistence, testDocs, async coll => {
57-
const query_ = query(
58-
coll,
59-
where('author', '==', 'authorA')
60-
).withConverter(postConverter);
61-
const snapshot = await getCountFromServer(query_);
62-
expect(snapshot.data().count).to.equal(1);
63-
});
64-
});
65-
66-
it('count query supports collection groups', () => {
67-
return withTestDb(persistence, async db => {
68-
const collectionGroupId = doc(collection(db, 'aggregateQueryTest')).id;
69-
const docPaths = [
70-
`${collectionGroupId}/cg-doc1`,
71-
`abc/123/${collectionGroupId}/cg-doc2`,
72-
`zzz${collectionGroupId}/cg-doc3`,
73-
`abc/123/zzz${collectionGroupId}/cg-doc4`,
74-
`abc/123/zzz/${collectionGroupId}`
75-
];
76-
const batch = writeBatch(db);
77-
for (const docPath of docPaths) {
78-
batch.set(doc(db, docPath), { x: 1 });
79-
}
80-
await batch.commit();
81-
const snapshot = await getCountFromServer(
82-
collectionGroup(db, collectionGroupId)
83-
);
84-
expect(snapshot.data().count).to.equal(2);
85-
});
86-
});
87-
88-
it('getCountFromServer fails if firestore is terminated', () => {
89-
return withEmptyTestCollection(persistence, async (coll, firestore) => {
90-
await terminate(firestore);
91-
expect(() => getCountFromServer(coll)).to.throw(
92-
'The client has already been terminated.'
93-
);
94-
});
95-
});
96-
97-
it("terminate doesn't crash when there is count query in flight", () => {
98-
return withEmptyTestCollection(persistence, async (coll, firestore) => {
99-
void getCountFromServer(coll);
100-
await terminate(firestore);
101-
});
102-
});
103-
104-
it('getCountFromServer fails if user is offline', () => {
105-
return withEmptyTestCollection(persistence, async (coll, firestore) => {
106-
await disableNetwork(firestore);
107-
await expect(getCountFromServer(coll)).to.be.eventually.rejectedWith(
108-
'Failed to get count result because the client is offline'
109-
);
110-
});
111-
});
112-
});
20+
import {
21+
collection,
22+
collectionGroup,
23+
doc,
24+
disableNetwork,
25+
query,
26+
terminate,
27+
where,
28+
writeBatch,
29+
getCountFromServer
30+
} from '../util/firebase_export';
31+
import {
32+
apiDescribe,
33+
postConverter,
34+
withEmptyTestCollection,
35+
withTestCollection,
36+
withTestDb
37+
} from '../util/helpers';
38+
39+
apiDescribe('Count query', (persistence: boolean) => {
40+
it('can run count query getCountFromServer', () => {
41+
const testDocs = {
42+
a: { author: 'authorA', title: 'titleA' },
43+
b: { author: 'authorB', title: 'titleB' }
44+
};
45+
return withTestCollection(persistence, testDocs, async coll => {
46+
const snapshot = await getCountFromServer(coll);
47+
expect(snapshot.data().count).to.equal(2);
48+
});
49+
});
50+
51+
it('count query supports withConverter', () => {
52+
const testDocs = {
53+
a: { author: 'authorA', title: 'titleA' },
54+
b: { author: 'authorB', title: 'titleB' }
55+
};
56+
return withTestCollection(persistence, testDocs, async coll => {
57+
const query_ = query(
58+
coll,
59+
where('author', '==', 'authorA')
60+
).withConverter(postConverter);
61+
const snapshot = await getCountFromServer(query_);
62+
expect(snapshot.data().count).to.equal(1);
63+
});
64+
});
65+
66+
it('count query supports collection groups', () => {
67+
return withTestDb(persistence, async db => {
68+
const collectionGroupId = doc(collection(db, 'aggregateQueryTest')).id;
69+
const docPaths = [
70+
`${collectionGroupId}/cg-doc1`,
71+
`abc/123/${collectionGroupId}/cg-doc2`,
72+
`zzz${collectionGroupId}/cg-doc3`,
73+
`abc/123/zzz${collectionGroupId}/cg-doc4`,
74+
`abc/123/zzz/${collectionGroupId}`
75+
];
76+
const batch = writeBatch(db);
77+
for (const docPath of docPaths) {
78+
batch.set(doc(db, docPath), { x: 1 });
79+
}
80+
await batch.commit();
81+
const snapshot = await getCountFromServer(
82+
collectionGroup(db, collectionGroupId)
83+
);
84+
expect(snapshot.data().count).to.equal(2);
85+
});
86+
});
87+
88+
it('getCountFromServer fails if firestore is terminated', () => {
89+
return withEmptyTestCollection(persistence, async (coll, firestore) => {
90+
await terminate(firestore);
91+
expect(() => getCountFromServer(coll)).to.throw(
92+
'The client has already been terminated.'
93+
);
94+
});
95+
});
96+
97+
it("terminate doesn't crash when there is count query in flight", () => {
98+
return withEmptyTestCollection(persistence, async (coll, firestore) => {
99+
void getCountFromServer(coll);
100+
await terminate(firestore);
101+
});
102+
});
103+
104+
it('getCountFromServer fails if user is offline', () => {
105+
return withEmptyTestCollection(persistence, async (coll, firestore) => {
106+
await disableNetwork(firestore);
107+
await expect(getCountFromServer(coll)).to.be.eventually.rejectedWith(
108+
'Failed to get count result because the client is offline'
109+
);
110+
});
111+
});
112+
});

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
aggregateFieldEqual,
2626
aggregateSnapshotEqual,
2727
count,
28-
getCountFromServer,
28+
getCountFromServer
2929
} from '../../src/lite-api/aggregate';
3030
import { Bytes } from '../../src/lite-api/bytes';
3131
import {
@@ -2237,7 +2237,7 @@ describe('countQuery()', () => {
22372237

22382238
it('aggregateFieldEqual on different aggregate fields', () => {
22392239
const AggregateField1 = count();
2240-
const AggregateField2 = new AggregateField("test")
2240+
const AggregateField2 = new AggregateField('test');
22412241
expect(aggregateFieldEqual(AggregateField1, AggregateField2)).to.be.false;
22422242
});
22432243

@@ -2295,4 +2295,4 @@ describe('countQuery()', () => {
22952295
expect(snapshot.data().count).to.equal(3);
22962296
});
22972297
});
2298-
});
2298+
});

0 commit comments

Comments
 (0)