import { type Transaction, type DocumentReference, type WriteBatch, type FirestoreContext, type FirestoreDocument, type AbstractFirestoreDocument } from '@dereekb/firebase'; import { type MockItemCollectionFixture } from '../mock'; import { type Getter } from '@dereekb/util'; /** * Registers a shared test suite that validates {@link FirestoreAccessorDriver} behavior * (CRUD operations, transactions, write batches, subcollections, and collection groups) * against a live or emulated Firestore instance. * * Call this once per driver implementation (e.g., client SDK, Admin SDK) to verify * that the driver conforms to the expected Firestore accessor contract. * * @param f - Fixture providing the mock item collections and parent context for the tests. */ export declare function describeFirestoreAccessorDriverTests(f: MockItemCollectionFixture): void; /** * Configuration object for {@link describeFirestoreDocumentAccessorTests}. * * Supplies the test suite with the context, document factories, test data, and * assertion helpers needed to validate document-level accessor operations * (get, set, update, create, delete, stream, transactions, write batches). */ export interface DescribeAccessorTests { /** * The Firestore context used for running transactions and creating batches. */ context: FirestoreContext; /** * Returns the document under test. Called fresh in each `beforeEach`. */ firestoreDocument: Getter>; /** * Returns partial data for the first of two sequential updates within a transaction. * Used to verify that non-overlapping fields survive a second update. */ dataForFirstOfTwoUpdates: () => Partial; /** * Returns partial data used for standard update/set assertions. */ dataForUpdate: () => Partial; /** * Optional predicate that checks whether fields from the first update * are still present after the second update was applied. When provided, * the multi-update transaction test will assert this returns `true`. */ hasRemainingDataFromFirstOfTwoUpdate?: (data: T) => boolean; /** * Predicate that returns `true` when the document's data reflects a successful update. */ hasDataFromUpdate: (data: T) => boolean; /** * Loads the document within a transaction context for transaction-based tests. */ loadDocumentForTransaction: (transaction: Transaction, ref?: DocumentReference) => AbstractFirestoreDocument; /** * Loads the document within a write batch context for batch-based tests. */ loadDocumentForWriteBatch: (writeBatch: WriteBatch, ref?: DocumentReference) => FirestoreDocument; } /** * Registers a shared test suite that validates document-level accessor operations * (get, set, update, create, delete, stream, transactions, and write batches) * for a single Firestore document type. * * This is called internally by {@link describeFirestoreAccessorDriverTests} for each * mock document type, but can also be invoked directly when testing custom document types. * * @param init - Factory that returns a fresh {@link DescribeAccessorTests} config for each test. */ export declare function describeFirestoreDocumentAccessorTests(init: () => DescribeAccessorTests): void;