Skip to content

Commit

Permalink
fix test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
crisnicandrei committed Dec 3, 2024
1 parent 67e08d2 commit 3866a9d
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,35 @@ describe('OnboardingComponent #onboarding', () => {

expect(mockRouter.navigate).toHaveBeenCalledWith(['/app', 'welcome']);
});

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

spyOn(localStorage, 'getItem').and.returnValue(null);
instance.isGlam = true;
instance.acceptedInvite = false;
instance.setScreen(OnboardingScreen.done);
instance.selectedPendingArchive = null;
fixture.detectChanges();
await fixture.whenStable();

expect(mockRouter.navigate).toHaveBeenCalledWith(['/app']);
});

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

spyOn(localStorage, 'getItem').and.returnValue(null);
instance.isGlam = false;
instance.acceptedInvite = true;
instance.setScreen(OnboardingScreen.done);
instance.selectedPendingArchive = null;
fixture.detectChanges();
await fixture.whenStable();

expect(mockRouter.navigate).toHaveBeenCalledWith([
'/app',
'welcome-invitation',
]);
});
});

0 comments on commit 3866a9d

Please sign in to comment.