No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

helpers.d.ts 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * @license
  3. * Copyright 2022 Google LLC
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import * as firestore from '@firebase/firestore-types';
  18. export declare function isPersistenceAvailable(): boolean;
  19. declare type ApiSuiteFunction = (message: string, testSuite: (persistence: boolean) => void) => void;
  20. interface ApiDescribe {
  21. (message: string, testSuite: (persistence: boolean) => void): void;
  22. skip: ApiSuiteFunction;
  23. only: ApiSuiteFunction;
  24. }
  25. export declare const apiDescribe: ApiDescribe;
  26. /** Converts the documents in a QuerySnapshot to an array with the data of each document. */
  27. export declare function toDataArray(docSet: firestore.QuerySnapshot): firestore.DocumentData[];
  28. /** Converts the changes in a QuerySnapshot to an array with the data of each document. */
  29. export declare function toChangesArray(docSet: firestore.QuerySnapshot, options?: firestore.SnapshotListenOptions): firestore.DocumentData[];
  30. export declare function toDataMap(docSet: firestore.QuerySnapshot): {
  31. [field: string]: firestore.DocumentData;
  32. };
  33. /** Converts a DocumentSet to an array with the id of each document */
  34. export declare function toIds(docSet: firestore.QuerySnapshot): string[];
  35. export declare function withTestDb(persistence: boolean, fn: (db: firestore.FirebaseFirestore) => Promise<void>): Promise<void>;
  36. /** Runs provided fn with a db for an alternate project id. */
  37. export declare function withAlternateTestDb(persistence: boolean, fn: (db: firestore.FirebaseFirestore) => Promise<void>): Promise<void>;
  38. export declare function withTestDbs(persistence: boolean, numDbs: number, fn: (db: firestore.FirebaseFirestore[]) => Promise<void>): Promise<void>;
  39. export declare function withTestDbsSettings(persistence: boolean, projectId: string, settings: firestore.Settings, numDbs: number, fn: (db: firestore.FirebaseFirestore[]) => Promise<void>): Promise<void>;
  40. export declare function withTestDoc(persistence: boolean, fn: (doc: firestore.DocumentReference) => Promise<void>): Promise<void>;
  41. export declare function withTestDocAndSettings(persistence: boolean, settings: firestore.Settings, fn: (doc: firestore.DocumentReference) => Promise<void>): Promise<void>;
  42. export declare function withTestDocAndInitialData(persistence: boolean, initialData: firestore.DocumentData | null, fn: (doc: firestore.DocumentReference) => Promise<void>): Promise<void>;
  43. export declare function withTestCollection(persistence: boolean, docs: {
  44. [key: string]: firestore.DocumentData;
  45. }, fn: (collection: firestore.CollectionReference) => Promise<void>): Promise<void>;
  46. export declare function withTestCollectionSettings(persistence: boolean, settings: firestore.Settings, docs: {
  47. [key: string]: firestore.DocumentData;
  48. }, fn: (collection: firestore.CollectionReference) => Promise<void>): Promise<void>;
  49. export {};