/** * In-memory mock implementation of IChatStorageProvider for property-based * and unit tests. * * Each IChatCollection is backed by a T[] array. findMany() returns the * full array by default, but can be configured to throw for error-propagation * tests. * * Also exports fast-check arbitraries for all BrightChat entity types. * * Requirements: all (test infrastructure) */ import fc from 'fast-check'; import { IChannel, ICommunicationMessage, IConversation, IGroup, IInviteToken } from '../../../interfaces/communication'; import { IChatCollection, IChatStorageProvider } from '../../../interfaces/communication/chatStorageProvider'; import { IServer, IServerInviteToken } from '../../../interfaces/communication/server'; /** * In-memory IChatCollection backed by a plain array. * * `findMany()` returns the full backing array unless `errorOnFindMany` is set, * in which case it throws the configured error. */ export declare class MockChatCollection implements IChatCollection { private items; private errorOnFindMany; constructor(initialItems?: T[]); /** Configure findMany() to throw the given error on next (and subsequent) calls. */ setFindManyError(error: Error): void; /** Clear any configured findMany() error. */ clearFindManyError(): void; create(doc: T): Promise; findById(key: string): Promise; findMany(_filter?: Partial): Promise; update(key: string, doc: T): Promise; delete(key: string): Promise; /** Direct access to the backing array (for test assertions). */ getItems(): T[]; } /** * In-memory IChatStorageProvider. All collections are MockChatCollection * instances that can be pre-populated and configured independently. */ export declare class MockChatStorageProvider implements IChatStorageProvider { readonly conversations: MockChatCollection; readonly messages: MockChatCollection; readonly groups: MockChatCollection; readonly groupMessages: MockChatCollection; readonly channels: MockChatCollection; readonly channelMessages: MockChatCollection; readonly inviteTokens: MockChatCollection; readonly servers: MockChatCollection; readonly serverInvites: MockChatCollection; constructor(opts?: { conversations?: IConversation[]; messages?: ICommunicationMessage[]; groups?: IGroup[]; groupMessages?: ICommunicationMessage[]; channels?: IChannel[]; channelMessages?: ICommunicationMessage[]; inviteTokens?: IInviteToken[]; servers?: IServer[]; serverInvites?: IServerInviteToken[]; }); } /** * Arbitrary for `Map>` representing * encrypted shared keys across 1–5 epochs. * * Each epoch maps 1–5 member IDs to a base64-like wrapped key string. */ export declare const arbEncryptedSharedKey: (minEpochs?: number, maxEpochs?: number) => fc.Arbitrary>>; /** * Arbitrary for IConversation. * Generates a conversation with two distinct participants and a valid * encryptedSharedKey map. */ export declare const arbConversation: fc.Arbitrary; /** * Arbitrary for IGroup. * Generates a group with 1–10 members and a valid encryptedSharedKey map. */ export declare const arbGroup: fc.Arbitrary; /** * Arbitrary for IChannel. * Generates a channel with members, visibility, and a valid encryptedSharedKey. */ export declare const arbChannel: fc.Arbitrary; /** * Arbitrary for IServer. * Generates a server with members, channels, and categories. */ export declare const arbServer: fc.Arbitrary; /** * Arbitrary for ICommunicationMessage. * Optionally accepts a fixed contextId; otherwise generates a random one. */ export declare const arbMessage: (contextId?: string) => fc.Arbitrary; /** * Arbitrary for IInviteToken. * Generates a channel invite token with valid metadata. */ export declare const arbInviteToken: fc.Arbitrary; /** * Arbitrary for IServerInviteToken. * Generates a server invite token with valid metadata. */ export declare const arbServerInviteToken: fc.Arbitrary; //# sourceMappingURL=mockChatStorageProvider.d.ts.map