Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
crisnicandrei committed Dec 3, 2024
1 parent 9185b50 commit 67e08d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,17 @@ describe('OnboardingComponent #onboarding', () => {
expect(removeItemSpy).toHaveBeenCalledWith('shareToken');
});

it('should navigate to /app if shareToken is not in localStorage', async () => {
it('should navigate to /app/welcome if shareToken is not in localStorage and isGlam is false', async () => {
const { instance, fixture } = await shallow.render();

spyOn(localStorage, 'getItem').and.returnValue(null);

instance.isGlam = false;
instance.acceptedInvite = false;
instance.setScreen(OnboardingScreen.done);
instance.selectedPendingArchive = null;
fixture.detectChanges();
await fixture.whenStable();

expect(mockRouter.navigate).toHaveBeenCalledWith(['/app']);
expect(mockRouter.navigate).toHaveBeenCalledWith(['/app', 'welcome']);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,14 @@ export class OnboardingComponent implements OnInit {
this.selectedPendingArchive = null;
}
if (screen === OnboardingScreen.done) {
if (!this.isGlam && this.acceptedInvite) {
this.router.navigate(['/app', 'welcome-invitation']);
}
if (localStorage.getItem('shareToken')) {
localStorage.removeItem('shareToken');
this.router.navigate(['/app', 'shares']);
} else if (!this.isGlam) {
this.router.navigate(['/app', 'welcome']);
} else {
this.router.navigate(['/app']);

Check warning on line 100 in src/app/onboarding/components/onboarding/onboarding.component.ts

View check run for this annotation

Codecov / codecov/patch

src/app/onboarding/components/onboarding/onboarding.component.ts#L100

Added line #L100 was not covered by tests
}
Expand Down

0 comments on commit 67e08d2

Please sign in to comment.