Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tests/navigation/isDynamicRouteScreenTests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import isDynamicRouteScreen from '@libs/Navigation/helpers/dynamicRoutesUtils/isDynamicRouteScreen';
import {normalizedConfigs} from '@libs/Navigation/linkingConfig/config';

import type {Screen} from '@src/SCREENS';
import SCREENS from '@src/SCREENS';

describe('isDynamicRouteScreen', () => {
Expand Down Expand Up @@ -37,6 +37,15 @@ describe('isDynamicRouteScreen', () => {
});

it('should return false for a screen name not present in normalizedConfigs', () => {
expect(isDynamicRouteScreen('NonExistentScreen_12345' as Screen)).toBe(false);
const screen = SCREENS.VALIDATE_LOGIN;
const config = normalizedConfigs[screen];

Reflect.deleteProperty(normalizedConfigs, screen);

try {
expect(isDynamicRouteScreen(screen)).toBe(false);
} finally {
normalizedConfigs[screen] = config;
}
});
});
8 changes: 4 additions & 4 deletions tests/unit/Navigation/getCreateReportRouteTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jest.mock('@libs/Navigation/Navigation', () => ({
jest.mock('@src/libs/Navigation/helpers/isSearchTopmostFullScreenRoute', () => jest.fn());

describe('getCreateReportRoute', () => {
const mockNavigate = Navigation.navigate as jest.MockedFunction<typeof Navigation.navigate>;
const mockGetActiveRoute = Navigation.getActiveRoute as jest.MockedFunction<typeof Navigation.getActiveRoute>;
const mockSetNavigationActionToMicrotaskQueue = Navigation.setNavigationActionToMicrotaskQueue as jest.MockedFunction<typeof Navigation.setNavigationActionToMicrotaskQueue>;
const mockIsSearchTopmostFullScreenRoute = isSearchTopmostFullScreenRoute as jest.MockedFunction<typeof isSearchTopmostFullScreenRoute>;
const mockNavigate = jest.mocked(Navigation.navigate);
const mockGetActiveRoute = jest.mocked(Navigation.getActiveRoute);
const mockSetNavigationActionToMicrotaskQueue = jest.mocked(Navigation.setNavigationActionToMicrotaskQueue);
const mockIsSearchTopmostFullScreenRoute = jest.mocked(isSearchTopmostFullScreenRoute);

beforeEach(() => {
jest.clearAllMocks();
Expand Down
12 changes: 11 additions & 1 deletion tests/unit/getOnboardingRouteFromScreenTest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import getOnboardingRouteFromScreen from '@libs/Navigation/helpers/getOnboardingRouteFromScreen';
import {normalizedConfigs} from '@libs/Navigation/linkingConfig/config';

import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
Expand All @@ -9,7 +10,16 @@ describe('getOnboardingRouteFromScreen', () => {
});

it('returns undefined for screens without a linking config path', () => {
expect(getOnboardingRouteFromScreen('not-a-screen' as typeof SCREENS.ONBOARDING.EMPLOYEES)).toBeUndefined();
const screen = SCREENS.ONBOARDING.EMPLOYEES;
const config = normalizedConfigs[screen];

Reflect.deleteProperty(normalizedConfigs, screen);

try {
expect(getOnboardingRouteFromScreen(screen)).toBeUndefined();
} finally {
normalizedConfigs[screen] = config;
}
});

it('matches ROUTES.getRoute when backTo is provided', () => {
Expand Down
Loading