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
4 changes: 0 additions & 4 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,6 @@ const ONYXKEYS = {
/** Stores the information about the state of issuing a new card */
ISSUE_NEW_EXPENSIFY_CARD: 'issueNewExpensifyCard_',

/** Used for identifying user as admin of a domain */
SHARED_NVP_PRIVATE_ADMIN_ACCESS: 'sharedNVP_private_admin_access_',

/** Stored the user information with whom bank account is being shared */
BANK_ACCOUNT_SHARE_DETAILS: 'expensify_bankAccountShare_',

Expand Down Expand Up @@ -1295,7 +1292,6 @@ type OnyxCollectionValuesMapping = {
[ONYXKEYS.COLLECTION.LAST_SELECTED_EXPENSIFY_CARD_FEED]: OnyxTypes.FundID;
[ONYXKEYS.COLLECTION.NVP_EXPENSIFY_ON_CARD_WAITLIST]: OnyxTypes.CardOnWaitlist;
[ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD]: OnyxTypes.IssueNewCard;
[ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS]: boolean;
[ONYXKEYS.COLLECTION.SAML_METADATA]: OnyxTypes.SamlMetadata;
[ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS]: OnyxTypes.DomainPendingActions;
[ONYXKEYS.COLLECTION.DOMAIN_ERRORS]: OnyxTypes.DomainErrors;
Expand Down
7 changes: 5 additions & 2 deletions src/hooks/useIsAllowedToIssueCompanyCard.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import {getCompanyFeeds, getSelectedFeed} from '@libs/CardUtils';
import {isPolicyAdmin as isPolicyAdminPolicyUtils} from '@libs/PolicyUtils';
import ONYXKEYS from '@src/ONYXKEYS';
import {isAdminSelector} from '@src/selectors/Domain';
import useCardFeeds from './useCardFeeds';
import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails';
import useOnyx from './useOnyx';
import usePolicy from './usePolicy';

function useIsAllowedToIssueCompanyCard({policyID}: {policyID?: string}) {
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const [lastSelectedFeed] = useOnyx(`${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${policyID}`);
const policy = usePolicy(policyID);
const isPolicyAdmin = isPolicyAdminPolicyUtils(policy);
Expand All @@ -15,13 +18,13 @@ function useIsAllowedToIssueCompanyCard({policyID}: {policyID?: string}) {
const selectedFeed = getSelectedFeed(lastSelectedFeed, cardFeeds);

const selectedFeedData = selectedFeed && companyCards[selectedFeed];
const [adminAccess] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${selectedFeedData?.domainID}`);
const [domain] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${selectedFeedData?.domainID}`);

if (selectedFeedData?.domainID === policy?.workspaceAccountID) {
return isPolicyAdmin;
}

return !!adminAccess;
return isAdminSelector(currentUserAccountID)(domain);
}

export default useIsAllowedToIssueCompanyCard;
8 changes: 5 additions & 3 deletions src/pages/domain/BaseDomainVerifiedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import LottieAnimations from '@components/LottieAnimations';
import RenderHTML from '@components/RenderHTML';
import ScreenWrapper from '@components/ScreenWrapper';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -16,6 +17,7 @@ import NotFoundPage from '@pages/ErrorPage/NotFoundPage';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import {isAdminSelector} from '@src/selectors/Domain';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';

type BaseDomainVerifiedPageProps = {
Expand All @@ -29,9 +31,10 @@ type BaseDomainVerifiedPageProps = {
function BaseDomainVerifiedPage({domainAccountID, redirectTo}: BaseDomainVerifiedPageProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();

const [domain, domainMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`);
const [isAdmin, isAdminMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainAccountID}`);
const isAdmin = isAdminSelector(currentUserAccountID)(domain);
const doesDomainExist = !!domain;

useEffect(() => {
Expand All @@ -41,11 +44,10 @@ function BaseDomainVerifiedPage({domainAccountID, redirectTo}: BaseDomainVerifie
Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(redirectTo, {forceReplace: true}));
}, [domainAccountID, domain?.validated, doesDomainExist, redirectTo]);

if (isLoadingOnyxValue(domainMetadata, isAdminMetadata)) {
if (isLoadingOnyxValue(domainMetadata)) {
const reasonAttributes: SkeletonSpanReasonAttributes = {
context: 'BaseDomainVerifiedPage',
isLoadingDomain: isLoadingOnyxValue(domainMetadata),
isLoadingAdmin: isLoadingOnyxValue(isAdminMetadata),
};
return <FullScreenLoadingIndicator reasonAttributes={reasonAttributes} />;
}
Expand Down
12 changes: 8 additions & 4 deletions src/pages/domain/DomainAddedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import {loadIllustration} from '@components/Icon/IllustrationLoader';
import ScreenWrapper from '@components/ScreenWrapper';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import {useMemoizedLazyAsset} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand All @@ -16,6 +17,7 @@ import NotFoundPage from '@pages/ErrorPage/NotFoundPage';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import {isAdminSelector} from '@src/selectors/Domain';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';

type DomainAddedPageProps = PlatformStackScreenProps<WorkspacesDomainModalNavigatorParamList, typeof SCREENS.WORKSPACES_DOMAIN_ADDED>;
Expand All @@ -24,14 +26,16 @@ function DomainAddedPage({route}: DomainAddedPageProps) {
const {asset: Encryption} = useMemoizedLazyAsset(() => loadIllustration('Encryption'));
const {translate} = useLocalize();
const styles = useThemeStyles();
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const domainAccountID = route.params.domainAccountID;
const [isAdmin, isAdminResults] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainAccountID}`);
const [domain, domainMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`);
const isAdmin = isAdminSelector(currentUserAccountID)(domain);

const isAdminLoading = isLoadingOnyxValue(isAdminResults);
if (isAdminLoading) {
const isDomainLoading = isLoadingOnyxValue(domainMetadata);
if (isDomainLoading) {
const reasonAttributes: SkeletonSpanReasonAttributes = {
context: 'DomainAddedPage',
isAdminLoading,
isDomainLoading,
};
return <FullScreenLoadingIndicator reasonAttributes={reasonAttributes} />;
}
Expand Down
7 changes: 5 additions & 2 deletions src/pages/domain/DomainInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import NAVIGATION_TABS from '@components/Navigation/NavigationTabBar/NAVIGATION_
import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
import useConfirmReadyToOpenApp from '@hooks/useConfirmReadyToOpenApp';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useDocumentTitle from '@hooks/useDocumentTitle';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
Expand All @@ -31,6 +32,7 @@ import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
import {isAdminSelector} from '@src/selectors/Domain';
import type IconAsset from '@src/types/utils/IconAsset';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';

Expand Down Expand Up @@ -58,11 +60,12 @@ function DomainInitialPage({route}: DomainInitialPageProps) {
const {translate} = useLocalize();
const shouldDisplayLHB = !shouldUseNarrowLayout;

const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const domainAccountID = route.params?.domainAccountID;
const [domain, domainMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`);
const domainName = domain?.email ? Str.extractEmailDomain(domain.email) : undefined;
useDocumentTitle(domainName ?? '');
const [isAdmin, adminMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainAccountID}`);
const isAdmin = isAdminSelector(currentUserAccountID)(domain);
const [domainErrors] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`);

const domainMenuItems: DomainMenuItem[] = [
Expand Down Expand Up @@ -103,7 +106,7 @@ function DomainInitialPage({route}: DomainInitialPageProps) {

useConfirmReadyToOpenApp();

const shouldShowFullScreenLoadingIndicator = isLoadingOnyxValue(domainMetadata, adminMetadata);
const shouldShowFullScreenLoadingIndicator = isLoadingOnyxValue(domainMetadata);

useEffect(() => {
if (shouldShowFullScreenLoadingIndicator || (domain && isAdmin)) {
Comment on lines +109 to 112

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Delay domain redirect until current user ID is loaded

isAdmin now depends on currentUserAccountID, which is 0 until session/personal details hydration completes, but this page’s loading gate only checks domainMetadata. On a refresh/deeplink where domain is already loaded but user identity is not, this effect runs with isAdmin === false and immediately calls Navigation.goBack, so real domain admins can be bounced out of Domain Initial before their account ID arrives. Please gate this redirect on user identity readiness (or equivalent admin-status loading) to avoid this startup race.

Useful? React with 👍 / 👎.

Expand Down
9 changes: 5 additions & 4 deletions src/pages/domain/DomainSamlPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
import Section from '@components/Section';
import SectionSubtitleHTML from '@components/SectionSubtitleHTML';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useDomainDocumentTitle from '@hooks/useDomainDocumentTitle';
import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
Expand All @@ -24,7 +25,7 @@ import colors from '@styles/theme/colors';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import {domainMemberSettingsSelector} from '@src/selectors/Domain';
import {domainMemberSettingsSelector, isAdminSelector} from '@src/selectors/Domain';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
import SamlConfigurationDetailsSectionContent from './Saml/SamlConfigurationDetailsSectionContent';
import SamlLoginSectionContent from './Saml/SamlLoginSectionContent';
Expand All @@ -37,9 +38,10 @@ function DomainSamlPage({route}: DomainSamlPageProps) {
const {translate} = useLocalize();
const illustrations = useMemoizedLazyIllustrations(['LaptopOnDeskWithCoffeeAndKey', 'LockClosed', 'OpenSafe', 'ShieldYellow']);

const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const domainAccountID = route.params?.domainAccountID;
const [domain, domainResults] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`);
const [isAdmin, isAdminResults] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainAccountID}`);
const isAdmin = isAdminSelector(currentUserAccountID)(domain);
const [domainSettings, domainSettingsResults] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainAccountID}`, {
selector: domainMemberSettingsSelector,
});
Expand Down Expand Up @@ -68,11 +70,10 @@ function DomainSamlPage({route}: DomainSamlPageProps) {
[illustrations.OpenSafe, illustrations.ShieldYellow, illustrations.LockClosed],
);

if (isLoadingOnyxValue(domainResults, isAdminResults, domainSettingsResults)) {
if (isLoadingOnyxValue(domainResults, domainSettingsResults)) {
const reasonAttributes: SkeletonSpanReasonAttributes = {
context: 'DomainSamlPage',
isLoadingDomain: isLoadingOnyxValue(domainResults),
isLoadingAdmin: isLoadingOnyxValue(isAdminResults),
isLoadingDomainSettings: isLoadingOnyxValue(domainSettingsResults),
};
return <FullScreenLoadingIndicator reasonAttributes={reasonAttributes} />;
Expand Down
8 changes: 4 additions & 4 deletions src/pages/workspace/WorkspacesListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import {isAdminSelector} from '@src/selectors/Domain';
import {accountIDToLoginSelector} from '@src/selectors/PersonalDetails';
import {ownerPoliciesSelector} from '@src/selectors/Policy';
import {reimbursementAccountErrorSelector} from '@src/selectors/ReimbursementAccount';
Expand Down Expand Up @@ -158,7 +159,6 @@ function WorkspacesListPage() {

const [allDomains] = useOnyx(ONYXKEYS.COLLECTION.DOMAIN);
const [allDomainErrors] = useOnyx(ONYXKEYS.COLLECTION.DOMAIN_ERRORS);
const [adminAccess] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS);
const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID);

const ownedPaidPolicies = ownerPoliciesSelector(policies, currentUserPersonalDetails?.accountID);
Expand Down Expand Up @@ -607,14 +607,14 @@ function WorkspacesListPage() {
if (!domain || !domain.accountID || !domain.email) {
return domainItems;
}
const isAdmin = !!adminAccess?.[`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domain.accountID}`];
const isDomainAdmin = isAdminSelector(currentUserPersonalDetails?.accountID)(domain);
const domainErrors = allDomainErrors?.[`${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domain.accountID}`];
domainItems.push({
listItemType: 'domain',
accountID: domain.accountID,
title: Str.extractEmailDomain(domain.email),
action: () => navigateToDomain({domainAccountID: domain.accountID, isAdmin}),
isAdmin,
action: () => navigateToDomain({domainAccountID: domain.accountID, isAdmin: isDomainAdmin}),
isAdmin: isDomainAdmin,
isValidated: domain.validated,
pendingAction: domain.pendingAction,
errors: domainErrors?.errors,
Expand Down
20 changes: 20 additions & 0 deletions src/selectors/Domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,25 @@ function groupsSelector(domain: OnyxEntry<Domain>): DomainSecurityGroupWithID[]

const accountLockSelector = (accountID: number) => (domain: OnyxEntry<Domain>) => domain?.[`${CONST.DOMAIN.PRIVATE_LOCKED_ACCOUNT_PREFIX}${accountID}`];

/**
* Creates a selector that checks if a given account ID is an admin of the domain.
* It checks whether the account ID appears as a value in any expensify_adminPermissions_* entry.
*
* @param accountID - The account ID to check admin status for
* @returns A selector function that takes a domain and returns boolean
*/
function isAdminSelector(accountID: number) {
return (domain: OnyxEntry<Domain>): boolean => {
if (!domain || !accountID) {
return false;
}

return Object.entries(domain).some(
([key, value]) => key.startsWith(CONST.DOMAIN.EXPENSIFY_ADMIN_ACCESS_PREFIX) && value !== undefined && value !== null && Number(value) === accountID,
);
};
}

export {
domainMemberSettingsSelector,
domainSettingsPrimaryContactSelector,
Expand All @@ -191,6 +210,7 @@ export {
groupsSelector,
vacationDelegateSelector,
accountLockSelector,
isAdminSelector,
};

export {type DomainSecurityGroupWithID};
46 changes: 46 additions & 0 deletions tests/unit/DomainSelectorsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
domainEmailSelector,
domainSettingsPrimaryContactSelector,
groupsSelector,
isAdminSelector,
isSecurityGroupEntry,
memberAccountIDsSelector,
selectSecurityGroupForAccount,
Expand Down Expand Up @@ -530,6 +531,51 @@ describe('domainSelectors', () => {
});
});

describe('isAdminSelector', () => {
it('Should return false if domain is undefined', () => {
expect(isAdminSelector(userID1)(undefined)).toBe(false);
});

it('Should return false if accountID is 0', () => {
const domain = {
[`${CONST.DOMAIN.EXPENSIFY_ADMIN_ACCESS_PREFIX}123456`]: userID1,
} as unknown as OnyxEntry<Domain>;
expect(isAdminSelector(0)(domain)).toBe(false);
});

it('Should return true if the accountID is found in admin permission entries', () => {
const domain = {
[`${CONST.DOMAIN.EXPENSIFY_ADMIN_ACCESS_PREFIX}123456`]: userID1,
[`${CONST.DOMAIN.EXPENSIFY_ADMIN_ACCESS_PREFIX}789101`]: userID2,
} as unknown as OnyxEntry<Domain>;

expect(isAdminSelector(userID1)(domain)).toBe(true);
expect(isAdminSelector(userID2)(domain)).toBe(true);
});

it('Should return false if the accountID is not in any admin permission entries', () => {
const domain = {
[`${CONST.DOMAIN.EXPENSIFY_ADMIN_ACCESS_PREFIX}123456`]: userID1,
} as unknown as OnyxEntry<Domain>;

expect(isAdminSelector(999)(domain)).toBe(false);
});

it('Should ignore null/undefined admin permission values', () => {
const domain = {
[`${CONST.DOMAIN.EXPENSIFY_ADMIN_ACCESS_PREFIX}123456`]: null,
[`${CONST.DOMAIN.EXPENSIFY_ADMIN_ACCESS_PREFIX}789101`]: undefined,
} as unknown as OnyxEntry<Domain>;

expect(isAdminSelector(userID1)(domain)).toBe(false);
});

it('Should return false for empty domain object', () => {
const domain = {} as OnyxEntry<Domain>;
expect(isAdminSelector(userID1)(domain)).toBe(false);
});
});

describe('accountLockSelector', () => {
it('Should return lock state for the given account ID', () => {
const accountID = 123;
Expand Down
20 changes: 18 additions & 2 deletions tests/unit/hooks/useIsAllowedToIssueCompanyCard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import useCardFeeds from '@hooks/useCardFeeds';
import useIsAllowedToIssueCompanyCard from '@hooks/useIsAllowedToIssueCompanyCard';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Domain} from '@src/types/onyx';
import createRandomPolicy from '../../utils/collections/policies';

const currentUserAccountID = 999;
const domainID = 19475968;
const mockPolicyID = '123456';
const workspaceAccountID = 11111111;
Expand Down Expand Up @@ -36,26 +38,40 @@ jest.mock('@hooks/useCardFeeds', () => ({
__esModule: true,
default: jest.fn(),
}));

jest.mock('@hooks/useCurrentUserPersonalDetails', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
default: () => ({accountID: currentUserAccountID}),
}));

describe('useIsAllowedToIssueCompanyCard', () => {
beforeAll(() => {
Onyx.init({
keys: ONYXKEYS,
});
});
beforeEach(async () => {
await Onyx.clear();
await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${mockPolicy?.policyID}`, mockPolicy);
});
it('should return true if domain feed and access is granted', async () => {
await Onyx.merge(`${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${mockPolicy?.policyID}`, 'vcf#19475968');
await Onyx.merge(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainID}`, true);
await Onyx.merge(`${ONYXKEYS.COLLECTION.DOMAIN}${domainID}`, {
[`${CONST.DOMAIN.EXPENSIFY_ADMIN_ACCESS_PREFIX}123456`]: currentUserAccountID,
} as unknown as Domain);
(useCardFeeds as jest.Mock).mockReturnValue([mockedFeeds, {status: 'loaded'}]);
const {result} = renderHook(() => useIsAllowedToIssueCompanyCard({policyID: mockPolicyID}));
expect(result?.current).toBe(true);
});

it('should return false if domain feed and access is not granted', async () => {
await Onyx.merge(`${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${mockPolicy?.policyID}`, 'vcf#19475968');
await Onyx.merge(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainID}`, false);
await Onyx.merge(`${ONYXKEYS.COLLECTION.DOMAIN}${domainID}`, {
validated: true,
accountID: domainID,
email: '+@test.com',
} as unknown as Domain);
(useCardFeeds as jest.Mock).mockReturnValue([mockedFeeds, {status: 'loaded'}]);
const {result} = renderHook(() => useIsAllowedToIssueCompanyCard({policyID: mockPolicyID}));
expect(result?.current).toBe(false);
Expand Down
Loading