From 3866a9dda28972f21bba1d1c584f700ca7674937 Mon Sep 17 00:00:00 2001 From: crisnicandrei <62384997+crisnicandrei@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:48:52 +0200 Subject: [PATCH] fix test coverage --- .../onboarding/onboarding.component.spec.ts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/app/onboarding/components/onboarding/onboarding.component.spec.ts b/src/app/onboarding/components/onboarding/onboarding.component.spec.ts index e51b89a2f..42b30fd56 100644 --- a/src/app/onboarding/components/onboarding/onboarding.component.spec.ts +++ b/src/app/onboarding/components/onboarding/onboarding.component.spec.ts @@ -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', + ]); + }); });