Skip to content

Commit

Permalink
[AUTOMATED]: Prettier Code Styling
Browse files Browse the repository at this point in the history
  • Loading branch information
avolkovi committed May 19, 2020
1 parent 5de57cd commit 8333925
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
16 changes: 11 additions & 5 deletions packages-exp/auth-exp/src/core/strategies/credential.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('core/strategies/signInWithCredential', () => {
createdAt: 123,
lastLoginAt: 456
};

const idTokenResponse: IdTokenResponse = {
idToken: 'my-id-token',
refreshToken: 'my-refresh-token',
Expand All @@ -51,7 +51,10 @@ describe('core/strategies/signInWithCredential', () => {
kind: 'my-kind'
};

const authCredential = new MockAuthCredential(ProviderId.FIREBASE, SignInMethod.EMAIL_LINK);
const authCredential = new MockAuthCredential(
ProviderId.FIREBASE,
SignInMethod.EMAIL_LINK
);

beforeEach(() => {
mockFetch.setUp();
Expand All @@ -63,17 +66,20 @@ describe('core/strategies/signInWithCredential', () => {
afterEach(mockFetch.tearDown);

it('should return a valid user credential', async () => {
const {credential, user, operationType } = await signInWithCredential(mockAuth, authCredential);
const { credential, user, operationType } = await signInWithCredential(
mockAuth,
authCredential
);
expect(credential!.providerId).to.eq(ProviderId.FIREBASE);
expect(credential!.signInMethod).to.eq(SignInMethod.EMAIL_LINK);
expect(user.uid).to.eq('local-id');
expect(user.tenantId).to.eq('tenant-id');
expect(user.displayName).to.eq('display-name');
expect(operationType).to.eq(OperationType.SIGN_IN);
});

it('should update the current user', async () => {
const { user } = await signInWithCredential(mockAuth, authCredential);
expect(mockAuth.currentUser).to.eq(user);
});
});
});
2 changes: 1 addition & 1 deletion packages-exp/auth-exp/src/core/user/user_impl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ describe('core/user/user_impl', () => {
auth.onAuthStateChanged(cb);
await auth.updateCurrentUser(null);
cb.resetHistory();

await UserImpl._fromIdTokenResponse(mockAuth, idTokenResponse);
expect(cb).not.to.have.been.called;
});
Expand Down
23 changes: 6 additions & 17 deletions packages-exp/auth-exp/test/mock_auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,17 @@ export const TEST_TOKEN_HOST = 'localhost/token';
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
8 changes: 4 additions & 4 deletions packages-exp/auth-exp/test/mock_auth_credential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { PhoneOrOauthTokenResponse } from '../src/api/authentication/mfa';
import { ProviderId, SignInMethod } from "../src/core/providers";
import { ProviderId, SignInMethod } from '../src/core/providers';
import { Auth } from '../src/model/auth';
import { AuthCredential } from '../src/model/auth_credential';
import { IdTokenResponse } from '../src/model/id_token';
Expand All @@ -27,15 +27,15 @@ export class MockAuthCredential implements AuthCredential {
constructor(
readonly providerId: ProviderId,
readonly signInMethod: SignInMethod
) { }
) {}

toJSON(): object {
throw new Error('Method not implemented.');
}

/**
* For testing purposes only
* @param response
* @param response
*/
_setIdTokenResponse(response: PhoneOrOauthTokenResponse): void {
this.response = response;
Expand All @@ -52,4 +52,4 @@ export class MockAuthCredential implements AuthCredential {
_matchIdTokenWithUid(_auth: Auth, _uid: string): Promise<IdTokenResponse> {
throw new Error('Method not implemented.');
}
}
}

0 comments on commit 8333925

Please sign in to comment.