Skip to content

Commit

Permalink
Use auth impl object instead of mock auth object (#3098)
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-gc committed May 21, 2020
1 parent 7b297c5 commit e71513a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages-exp/auth-exp/src/core/auth/auth_impl.ts
Expand Up @@ -38,7 +38,7 @@ export const DEFAULT_TOKEN_API_HOST = 'securetoken.googleapis.com';
export const DEFAULT_API_HOST = 'identitytoolkit.googleapis.com';
export const DEFAULT_API_SCHEME = 'https';

class AuthImpl implements Auth {
export class AuthImpl implements Auth {
currentUser: User | null = null;
private operations = Promise.resolve();
private persistenceManager?: PersistenceUserManager;
Expand Down
24 changes: 8 additions & 16 deletions packages-exp/auth-exp/test/mock_auth.ts
Expand Up @@ -15,38 +15,30 @@
* limitations under the License.
*/

import { AuthImpl } from '../src/core/auth/auth_impl';
import { StsTokenManager } from '../src/core/user/token_manager';
import { UserImpl } from '../src/core/user/user_impl';
import { Auth } from '../src/model/auth';
import { User } from '../src/model/user';

export const TEST_HOST = 'localhost';
export const TEST_TOKEN_HOST = 'localhost/token';
export const TEST_AUTH_DOMAIN = 'localhost';
export const TEST_SCHEME = 'mock';
export const TEST_KEY = 'test-api-key';

export const mockAuth: Auth = ({
name: 'test-app',
config: {
export const mockAuth: Auth = new AuthImpl(
'test-app',
{
apiKey: TEST_KEY,
authDomain: TEST_AUTH_DOMAIN,
apiHost: TEST_HOST,
apiScheme: TEST_SCHEME,
tokenApiHost: TEST_TOKEN_HOST,
sdkClientVersion: 'testSDK/0.0.0'
},
_isInitialized: true,
currentUser: null,
async setPersistence() {},
async updateCurrentUser() {},
async signOut() {},
onAuthStateChanged() {
return () => {};
},
onIdTokenChanged() {
return () => {};
},
_notifyStateListeners() {}
} as unknown) as Auth;
[],
);

export function testUser(
uid: string,
Expand Down

0 comments on commit e71513a

Please sign in to comment.