Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davideast committed Jul 11, 2023
1 parent 5b99681 commit 4dc2a9c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 42 deletions.
4 changes: 2 additions & 2 deletions firestore/collection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
import {snapToData} from '../document';
import {DocumentChangeType, DocumentChange, Query, QueryDocumentSnapshot, QuerySnapshot, DocumentData} from '../interfaces';
import {getCountFromServer, refEqual} from 'firebase/firestore';
import { CountSnapshot } from '../lite/interfaces';
import {CountSnapshot} from '../lite/interfaces';
const ALL_EVENTS: DocumentChangeType[] = ['added', 'modified', 'removed'];

/**
Expand Down Expand Up @@ -303,5 +303,5 @@ export function collectionCountSnap$(query: Query<unknown>): Observable<CountSna
}

export function collectionCount$(query: Query<unknown>): Observable<number> {
return collectionCountSnap$(query).pipe(map(snap => snap.data().count));
return collectionCountSnap$(query).pipe(map((snap) => snap.data().count));
}
2 changes: 1 addition & 1 deletion firestore/lite/collection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ export function collectionCountSnap$(query: Query<unknown>): Observable<CountSna
}

export function collectionCount$(query: Query<unknown>): Observable<number> {
return collectionCountSnap$(query).pipe(map(snap => snap.data().count));
return collectionCountSnap$(query).pipe(map((snap) => snap.data().count));
}
37 changes: 16 additions & 21 deletions test/firestore-lite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ describe('RxFire firestore/lite', () => {

afterEach((done) => {
deleteApp(app)
.then(() => done())
.catch(() => undefined);
.then(() => done())
.catch(() => undefined);
});

describe('collection', () => {
Expand Down Expand Up @@ -227,40 +227,35 @@ describe('RxFire firestore/lite', () => {
});

describe('Aggregations', () => {

it('should provide an observable with a count aggregate', async (done) => {
const colRef = createRandomCol(firestore);
const entries = [
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
];
await Promise.all(entries)
collectionCountSnap$(colRef).subscribe(snap => {
await Promise.all(entries);

collectionCountSnap$(colRef).subscribe((snap) => {
expect(snap.data().count).toEqual(entries.length);
done();
});

});

it('should provide an observable with a count aggregate number', async (done) => {
const colRef = createRandomCol(firestore);
const entries = [
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
];
await Promise.all(entries)
collectionCount$(colRef).subscribe(count => {
await Promise.all(entries);

collectionCount$(colRef).subscribe((count) => {
expect(count).toEqual(entries.length);
done();
});

});

})

});
});
32 changes: 14 additions & 18 deletions test/firestore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,39 +426,35 @@ describe('RxFire Firestore', () => {
});

describe('Aggregations', () => {

it('should provide an observable with a count aggregate snapshot', async (done) => {
const colRef = createRandomCol(firestore);
const entries = [
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
];
await Promise.all(entries)
collectionCountSnap$(colRef).subscribe(snap => {
await Promise.all(entries);

collectionCountSnap$(colRef).subscribe((snap) => {
expect(snap.data().count).toEqual(entries.length);
done();
});

});

it('should provide an observable with a count aggregate number', async (done) => {
const colRef = createRandomCol(firestore);
const entries = [
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, { id: createId() }),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
addDoc(colRef, {id: createId()}),
];
await Promise.all(entries)
collectionCount$(colRef).subscribe(count => {
await Promise.all(entries);

collectionCount$(colRef).subscribe((count) => {
expect(count).toEqual(entries.length);
done();
});

});

})
});
});

0 comments on commit 4dc2a9c

Please sign in to comment.