Skip to content

Commit 68ded35

Browse files
authored
fix: Fix verify email flow bug for duplicate access token calls (#3440)
* Fix verify email flow bug for duplicate access token callsgs * fix lint and tests * kill me
1 parent c661325 commit 68ded35

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/app/auth/verify/verify.page.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import { RouterTestingModule } from '@angular/router/testing';
77
import { RouterAuthService } from 'src/app/core/services/router-auth.service';
88
import { AuthService } from 'src/app/core/services/auth.service';
99
import { TrackingService } from 'src/app/core/services/tracking.service';
10-
import { of, throwError } from 'rxjs';
10+
import { of } from 'rxjs';
1111
import { apiEouRes } from 'src/app/core/mock-data/extended-org-user.data';
12-
import { getElementBySelector, getTextContent } from 'src/app/core/dom-helpers';
13-
import { VerifyPageState } from './verify.enum';
1412
import { UserEventService } from 'src/app/core/services/user-event.service';
1513

1614
describe('VerifyPage', () => {
@@ -25,7 +23,7 @@ describe('VerifyPage', () => {
2523
beforeEach(waitForAsync(() => {
2624
const routerSpy = jasmine.createSpyObj('Router', ['navigate']);
2725
const routerAuthServiceSpy = jasmine.createSpyObj('RouterAuthService', ['emailVerify']);
28-
const authServiceSpy = jasmine.createSpyObj('AuthService', ['newRefreshToken']);
26+
const authServiceSpy = jasmine.createSpyObj('AuthService', ['refreshEou']);
2927
const trackingServiceSpy = jasmine.createSpyObj('TrackingService', ['emailVerified', 'onSignin']);
3028
const userEventServiceSpy = jasmine.createSpyObj('UserEventService', ['logout']);
3129

@@ -81,7 +79,7 @@ describe('VerifyPage', () => {
8179
it('should navigate to switch_org route when verification is successful', () => {
8280
const mockResponse = { refresh_token: 'xyz123' };
8381
routerAuthService.emailVerify.and.returnValue(of(mockResponse));
84-
authService.newRefreshToken.and.returnValue(of(apiEouRes));
82+
authService.refreshEou.and.returnValue(of(apiEouRes));
8583
fixture.detectChanges();
8684
expect(trackingService.emailVerified).toHaveBeenCalledTimes(1);
8785
expect(trackingService.onSignin).toHaveBeenCalledOnceWith('[email protected]');

src/app/auth/verify/verify.page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class VerifyPage implements OnInit {
2626
this.routerAuthService
2727
.emailVerify(verificationCode)
2828
.pipe(
29-
switchMap((resp) => this.authService.newRefreshToken(resp.refresh_token)),
29+
switchMap(() => this.authService.refreshEou()),
3030
tap((eou) => {
3131
this.trackingService.emailVerified();
3232
this.trackingService.onSignin(eou.us.email);

0 commit comments

Comments
 (0)