Skip to content

Commit 1753549

Browse files
committed
testing_hooks.ts: add @internal tag to TestingHooks class so it doesn't appear in common/api-review/firestore.api.md. Also do a tiny bit of cosmetic changes.
1 parent c1bff43 commit 1753549

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

common/api-review/firestore.api.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -556,14 +556,6 @@ export type TaskState = 'Error' | 'Running' | 'Success';
556556
// @public
557557
export function terminate(firestore: Firestore): Promise<void>;
558558

559-
// @public
560-
export class _TestingHooks {
561-
static getOrCreateInstance(): _TestingHooks;
562-
static get instance(): _TestingHooks | null;
563-
notifyOnExistenceFilterMismatch(arg: unknown): void;
564-
onExistenceFilterMismatch(callback: (arg: unknown) => void): () => void;
565-
}
566-
567559
// @public
568560
export class Timestamp {
569561
constructor(

packages/firestore/src/util/testing_hooks.ts

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

18-
let gTestingHooksSingletonInstance: TestingHooks | null = null;
19-
2018
/**
2119
* Manages "testing hooks", hooks into the internals of the SDK to verify
2220
* internal state and events during integration tests. Do not use this class
@@ -31,6 +29,8 @@ let gTestingHooksSingletonInstance: TestingHooks | null = null;
3129
* Use the former method if the caller should "do nothing" there are no testing
3230
* hooks registered. Use the latter if the instance is needed to, for example,
3331
* register a testing hook.
32+
*
33+
* @internal
3434
*/
3535
export class TestingHooks {
3636
private readonly onExistenceFilterMismatchCallbacks: Array<
@@ -81,8 +81,15 @@ export class TestingHooks {
8181

8282
/**
8383
* Invokes all currently-registered `onExistenceFilterMismatch` callbacks.
84+
* @param arg the argument to specify to the callbacks; the type of this
85+
* argument is intentionally declared as `unknown` to discourage casual use;
86+
* the specific use of this callback in tests knows the structure of the
87+
* given argument and will use it accordingly.
8488
*/
8589
notifyOnExistenceFilterMismatch(arg: unknown): void {
8690
this.onExistenceFilterMismatchCallbacks.forEach(callback => callback(arg));
8791
}
8892
}
93+
94+
/** The global singleton instance of `TestingHooks`. */
95+
let gTestingHooksSingletonInstance: TestingHooks | null = null;

0 commit comments

Comments
 (0)