Skip to content

Commit

Permalink
feat: remove unnecessary console.log statements in auth-google module
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayen Mabrouk committed May 11, 2024
1 parent 20f3e14 commit 2707116
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 56 deletions.
1 change: 0 additions & 1 deletion src/auth-google/auth-google.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export class AuthGoogleController {
'google',
socialData,
);
console.log(response);
const { refreshToken, token, tokenExpires, ...rest } = response;
void res.clearCookie(AccessTokenName);
void res.clearCookie(RefreshTokenName);
Expand Down
51 changes: 0 additions & 51 deletions src/auth-google/auth-google.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,55 +37,4 @@ describe('AuthGoogleService', () => {
console.log(google, configService);
expect(service).toBeDefined();
});

// it('should get profile by token', async () => {
// const dto: AuthGoogleLoginDto = {
// idToken: 'testToken.test.test',
// };
// const data = {
// sub: '123',
// email: '[email protected]',
// given_name: 'John',
// family_name: 'Doe',
// picture: 'testPicture',
// };
// const generatedIDToken = jest.fn(
// () => `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c`,
// )
// // jest.spyOn(service.google, 'verifyIdToken').mockResolvedValue({
// // getPayload: () => data,
// // } as never);

// // const result = await service.getProfileByToken({idToken: generatedIDToken()});
// expect(service.getProfileByToken).toHaveBeenCalled();

// expect(result).toEqual({
// id: '123',
// email: '[email protected]',
// firstName: 'John',
// lastName: 'Doe',
// picture: 'testPicture',
// });
// });

// it('should throw an exception if token is wrong', async () => {
// const dto: AuthGoogleLoginDto = {
// idToken: 'testToken,.azrazr.azrazr',
// };
// // jest.spyOn(service.google, 'verifyIdToken').mockResolvedValue({
// // getPayload: () => null,
// // } as never);

// await expect(service.getProfileByToken(dto)).rejects.toThrow(
// new HttpException(
// {
// status: HttpStatus.UNPROCESSABLE_ENTITY,
// errors: {
// user: 'wrongToken',
// },
// },
// HttpStatus.UNPROCESSABLE_ENTITY,
// ),
// );
// });
});
4 changes: 0 additions & 4 deletions src/auth-google/auth-google.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ export class AuthGoogleService {

constructor(private configService: ConfigService<AllConfigType>) {
this.google = new OAuth2Client(
// '250111890042-ema26th73h1k9gpnj8trgvplk6vqfc4m.apps.googleusercontent.com',
// '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',
// configService.get('google.clientId', { infer: true }),
// configService.get('google.clientSecret', { infer: true }),
process.env.GOOGLE_CLIENT_ID,
process.env.GOOGLE_CLIENT_SECRET,
);
Expand Down

0 comments on commit 2707116

Please sign in to comment.