Skip to content

Commit 10857ff

Browse files
author
Brian Chen
committed
calling public API
1 parent 15d1b16 commit 10857ff

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

packages/firestore/src/api/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ export class Firestore implements firestore.FirebaseFirestore, FirebaseService {
410410
);
411411
}
412412

413-
_clearPersistence(): Promise<void> {
413+
clearPersistence(): Promise<void> {
414414
if (this.clientRunning) {
415415
throw new FirestoreError(
416416
Code.FAILED_PRECONDITION,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { EventsAccumulator } from '../util/events_accumulator';
2929
import firebase from '../util/firebase_export';
3030
import {
3131
apiDescribe,
32-
clearPersistence,
3332
withTestCollection,
3433
withTestDb,
3534
withTestDbs,
@@ -953,13 +952,14 @@ apiDescribe('Database', persistence => {
953952
'can clear persistence if the client has not been initialized',
954953
async () => {
955954
await withTestDoc(persistence, async docRef => {
955+
const firestore = docRef.firestore;
956956
await docRef.set({ foo: 'bar' });
957957
const app = docRef.firestore.app;
958958
const name = app.name;
959959
const options = app.options;
960960

961961
await app.delete();
962-
await clearPersistence(docRef.firestore);
962+
await firestore.clearPersistence();
963963
const app2 = firebase.initializeApp(options, name);
964964
const firestore2 = firebase.firestore!(app2);
965965
await firestore2.enablePersistence();
@@ -974,7 +974,7 @@ apiDescribe('Database', persistence => {
974974
it('can not clear persistence if the client has been initialized', async () => {
975975
await withTestDoc(persistence, async docRef => {
976976
const firestore = docRef.firestore;
977-
await expect(clearPersistence(firestore)).to.eventually.be.rejectedWith(
977+
await expect(firestore.clearPersistence()).to.eventually.be.rejectedWith(
978978
'Persistence cannot be cleared while the client is running'
979979
);
980980
});

packages/firestore/test/integration/util/helpers.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,6 @@ function apiDescribeInternal(
106106
}
107107
}
108108

109-
// TODO(b/131094514): Remove after clearPersistence() is updated in index.d.ts.
110-
export async function clearPersistence(
111-
firestore: firestore.FirebaseFirestore
112-
): Promise<void> {
113-
// tslint:disable-next-line:no-any
114-
await (firestore as any)._clearPersistence();
115-
}
116-
117109
/** Converts the documents in a QuerySnapshot to an array with the data of each document. */
118110
export function toDataArray(
119111
docSet: firestore.QuerySnapshot

0 commit comments

Comments
 (0)