mockbase
Version:
Firebase v7+ mock.
27 lines (26 loc) • 969 B
TypeScript
import { User, UserSchema } from "./user";
import { SocialSignInMock } from "./social-signin-mock";
export declare class UserStore {
private nextId;
private store;
private readonly socialMocks;
/**
* Adds a user to this store with the given data.
* The new user is assigned a new ID and is returned.
*/
add(data: Partial<UserSchema>): User;
addSocialMock(mock: SocialSignInMock): void;
/**
* Finds the mock response for a given AuthProvider, removes it from the list of mocks
* and returns its response.
*
* If a mock for that AuthProvider is not set, then this method throws.
*/
consumeSocialMock(provider: firebase.auth.AuthProvider): Promise<{
displayName: string;
email: string;
}>;
findByEmail(email: string): User | undefined;
findByProviderAndEmail(email: string, providerId: string): User | undefined;
update(id: string, data: Partial<UserSchema>): void;
}