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.

mock_auth.d.ts 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @license
  3. * Copyright 2020 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 { Provider } from '@firebase/component';
  18. import { PopupRedirectResolver } from '../../src/model/public_types';
  19. import { AuthImpl } from '../../src/core/auth/auth_impl';
  20. import { PersistedBlob } from '../../src/core/persistence';
  21. import { InMemoryPersistence } from '../../src/core/persistence/in_memory';
  22. import { AuthInternal } from '../../src/model/auth';
  23. import { UserInternal } from '../../src/model/user';
  24. export declare const TEST_HOST = "localhost";
  25. export declare const TEST_TOKEN_HOST = "localhost/token";
  26. export declare const TEST_AUTH_DOMAIN = "localhost";
  27. export declare const TEST_SCHEME = "mock";
  28. export declare const TEST_KEY = "test-api-key";
  29. export interface TestAuth extends AuthImpl {
  30. persistenceLayer: MockPersistenceLayer;
  31. }
  32. export declare const FAKE_HEARTBEAT_CONTROLLER: {
  33. getHeartbeatsHeader: () => Promise<string>;
  34. };
  35. export declare const FAKE_HEARTBEAT_CONTROLLER_PROVIDER: Provider<'heartbeat'>;
  36. export declare class MockPersistenceLayer extends InMemoryPersistence {
  37. lastObjectSet: PersistedBlob | null;
  38. _set(key: string, object: PersistedBlob): Promise<void>;
  39. _remove(key: string): Promise<void>;
  40. }
  41. export declare function testAuth(popupRedirectResolver?: PopupRedirectResolver, persistence?: MockPersistenceLayer, skipAwaitOnInit?: boolean): Promise<TestAuth>;
  42. export declare function testUser(auth: AuthInternal, uid: string, email?: string, fakeTokens?: boolean): UserInternal;