File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
flow_screen_components/datatable/force-app/main/default/classes Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,27 @@ private with sharing class ers_DatatableControllerTest {
8888
8989 @IsTest
9090 private static void testGetIconName () {
91- System .assertEquals (' standard:account' , ers_DatatableController .getIconName (' Account' ));
92- System .assertEquals (' standard:contact' , ers_DatatableController .getIconName (' Contact' ));
91+ List <SObject > apiOnlyPerms = [
92+ SELECT Id
93+ FROM PermissionSetAssignment
94+ WHERE AssigneeId = : UserInfo .getUserId ()
95+ AND PermissionSet.PermissionsApiUserOnly = true
96+ LIMIT 1
97+ ];
98+
99+ Test .startTest ();
100+ String accountIcon = ers_DatatableController .getIconName (' Account' );
101+ String contactIcon = ers_DatatableController .getIconName (' Contact' );
102+ Test .stopTest ();
103+
104+ if (apiOnlyPerms ?. isEmpty ()) {
105+ Assert .areEqual (' standard:account' , accountIcon );
106+ Assert .areEqual (' standard:contact' , contactIcon );
107+ } else {
108+ // API Only users don't have access to view tabs; this method will return null
109+ // Necessary to prevent this test from failing when run by CICD/integrations
110+ Assert .isNull (accountIcon );
111+ Assert .isNull (contactIcon );
112+ }
93113 }
94114}
You can’t perform that action at this time.
0 commit comments