Skip to content
Closed
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
1 change: 0 additions & 1 deletion .github/scripts/known-feature-flag-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const FILE_SOURCES: Array<{ key: string; file: string; exportName: string }> = [
{ key: 'SNAPSHOTS_REWARDS_FLAG_NAME', file: REWARDS_FILE, exportName: 'SNAPSHOTS_REWARDS_FLAG_NAME' },
{ key: 'MISSING_ENROLLED_ACCOUNTS_FLAG_NAME', file: REWARDS_FILE, exportName: 'MISSING_ENROLLED_ACCOUNTS_FLAG_NAME' },
{ key: 'CAMPAIGNS_REWARDS_FLAG_NAME', file: REWARDS_FILE, exportName: 'CAMPAIGNS_REWARDS_FLAG_NAME' },
{ key: 'ACCOUNT_MENU_FLAG_KEY', file: sel('accountMenu'), exportName: 'ACCOUNT_MENU_FLAG_KEY' },
{ key: 'NETWORK_MANAGEMENT_FLAG_KEY', file: sel('networkManagement'), exportName: 'NETWORK_MANAGEMENT_FLAG_KEY' },
// FEATURE_FLAG_NAME is omitted (non-unique across rwa / gasFeesSponsored); per-file fallback handles it.
{ key: 'OTA_UPDATES_FLAG_NAME', file: sel('otaUpdates'), exportName: 'OTA_UPDATES_FLAG_NAME' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { backgroundState } from '../../../../util/test/initial-root-state';
import TabBar from './TabBar';
import { TabBarIconKey, ExtendedBottomTabDescriptor } from './TabBar.types';
import Routes from '../../../../constants/navigation/Routes';
import { useAccountMenuEnabled } from '../../../../selectors/featureFlagController/accountMenu/useAccountMenuEnabled';

// Minimal descriptor interface for tests - only includes what TabBar component uses
interface TestTabDescriptor {
Expand All @@ -30,14 +29,6 @@ interface TestDescriptors {
[key: string]: TestTabDescriptor;
}

// Mock account menu feature flag hook
jest.mock(
'../../../../selectors/featureFlagController/accountMenu/useAccountMenuEnabled',
() => ({
useAccountMenuEnabled: jest.fn(() => false),
}),
);

// Mock the navigation object with proper typing
const navigation: NavigationHelpers<ParamListBase> = {
navigate: jest.fn(),
Expand Down Expand Up @@ -129,10 +120,7 @@ describe('TabBar', () => {
expect(toJSON()).toMatchSnapshot();
});

it('navigates to the correct screen when a tab is pressed and account menu is disabled', () => {
// Explicitly disable the account menu feature flag for this test
jest.mocked(useAccountMenuEnabled).mockReturnValue(false);

it('navigates to the correct screen when a tab is pressed', () => {
const { getByTestId } = renderWithProvider(
<TabBar
state={state as TabNavigationState<ParamListBase>}
Expand Down Expand Up @@ -168,7 +156,7 @@ describe('TabBar', () => {

fireEvent.press(getByTestId(`tab-bar-item-${TabBarIconKey.Setting}`));
expect(navigation.navigate).toHaveBeenCalledWith(Routes.SETTINGS_VIEW, {
screen: 'Settings',
screen: Routes.ACCOUNTS_MENU_VIEW,
});
});

Expand Down Expand Up @@ -230,23 +218,4 @@ describe('TabBar', () => {
fireEvent.press(getByTestId(`tab-bar-item-${TabBarIconKey.Trending}`));
expect(navigation.navigate).toHaveBeenCalledWith(Routes.TRENDING_VIEW);
});

it('navigates to Accounts Menu when settings tab is pressed and account menu is enabled', () => {
// Enable the account menu feature flag for this test
jest.mocked(useAccountMenuEnabled).mockReturnValue(true);

const { getByTestId } = renderWithProvider(
<TabBar
state={state as TabNavigationState<ParamListBase>}
descriptors={descriptors as Record<string, ExtendedBottomTabDescriptor>}
navigation={navigation}
/>,
{ state: mockInitialState },
);

fireEvent.press(getByTestId(`tab-bar-item-${TabBarIconKey.Setting}`));
expect(navigation.navigate).toHaveBeenCalledWith(Routes.SETTINGS_VIEW, {
screen: Routes.ACCOUNTS_MENU_VIEW,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
LABEL_BY_TAB_BAR_ICON_KEY,
} from './TabBar.constants';
import { selectChainId } from '../../../../selectors/networkController';
import { useAccountMenuEnabled } from '../../../../selectors/featureFlagController/accountMenu/useAccountMenuEnabled';

const FILLED_ICONS: Partial<Record<TabBarIconKey, IconName>> = {
[TabBarIconKey.Wallet]: IconName.HomeFilled,
Expand All @@ -41,7 +40,6 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
const { trackEvent, createEventBuilder } = useMetrics();
const { bottom: bottomInset } = useSafeAreaInsets();
const chainId = useSelector(selectChainId);
const isAccountMenuEnabled = useAccountMenuEnabled();
const tabBarRef = useRef(null);
const previousTabIndexRef = useRef<number>(state.index);
const tw = useTailwind();
Expand Down Expand Up @@ -107,9 +105,7 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
break;
case Routes.SETTINGS_VIEW:
navigation.navigate(Routes.SETTINGS_VIEW, {
screen: isAccountMenuEnabled
? Routes.ACCOUNTS_MENU_VIEW
: 'Settings',
screen: Routes.ACCOUNTS_MENU_VIEW,
});
break;
case Routes.TRENDING_VIEW:
Expand Down Expand Up @@ -146,7 +142,6 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
trackEvent,
createEventBuilder,
tw,
isAccountMenuEnabled,
],
);

Expand Down
Loading
Loading