buli
2023-07-11 80a3f59e2d3df07805bc67e329300b8de90a5b3a
force-app/main/default/classes/LayoutDescriberHelperTest.cls
@@ -4,7 +4,9 @@
       String userMode = 'classic';//classic  lightning
       String objectType = 'Contact';
       String recordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Doctor').getRecordTypeId();
        System.debug('record type id ===>' + recordTypeId + ' object type===>' + objectType + ' userMode===>' + userMode);
        boolean useHeader = false;
        String baseurl = System.URL.getOrgDomainUrl().getHost();
       Map<String,object> detailsMap = new Map<String,object>();
       Map<String,object> detailsMap2 = new Map<String,object>();
       Map<String,object> detailsMap3 = new Map<String,object>();
@@ -17,6 +19,7 @@
       detailsMap3.put('calculated',false);
       detailsMap3.put('autoNumber',false);
       detailsMap3.put('type','repair');
        String fieldTypeDetail = (String) detailsMap.get('type');
       List<Map<String, object>> componentMapList = new List<Map<String, object>>();
       List<Map<String, object>> componentMapList2 = new List<Map<String, object>>();
@@ -36,6 +39,8 @@
       componentMap3.put('type','Field');
       componentMap3.put('details',detailsMap3);
       componentMapList3.add(componentMap3);
        String apiName = (String) componentMap.get('value');
        String fieldType = (String) componentMap.get('type');
       List<Map<String, object>> layoutComponentsList = new List<Map<String, object>>();
       Map<String, object> layoutComponents = new Map<String, object>();
@@ -43,6 +48,7 @@
       layoutComponents.put('label','Address');
       layoutComponents.put('placeholder',true);
       layoutComponents.put('editableForNew',true);
        layoutComponents.put('editableForUpdate', true);
       layoutComponents.put('required',false);
       layoutComponentsList.add(layoutComponents);
       Map<String, object> layoutComponents2 = new Map<String, object>();
@@ -50,6 +56,7 @@
       layoutComponents2.put('label','Repair');
       layoutComponents2.put('placeholder',true);
       layoutComponents2.put('editableForNew',true);
        layoutComponents2.put('editableForUpdate', true);
       layoutComponents2.put('required',false);
       layoutComponentsList.add(layoutComponents2);
       Map<String, object> layoutComponents3 = new Map<String, object>();
@@ -57,19 +64,22 @@
       layoutComponents3.put('label','Repair');
       layoutComponents3.put('placeholder',true);
       layoutComponents3.put('editableForNew',true);
        layoutComponents3.put('editableForUpdate', true);
       layoutComponents3.put('required',false);
       layoutComponentsList.add(layoutComponents3);
        boolean placeholderF = (boolean) layoutComponents.get('placeholder');
        boolean isEditable = (boolean) layoutComponents.get('editableForUpdate') || (boolean) layoutComponents.get('editableForNew');
        System.debug('isEditable ===>' + isEditable);
       List<Map<String,object>> itemList = new List<Map<String,object>>();
       Map<String,object> item = new Map<String,object>();
       item.put('layoutItems',layoutComponentsList);
       itemList.add(item);
        useHeader = true;
       List<Map<String,object>> sectionList = new List<Map<String,object>>();
       Map<String,object> section = new Map<String,object>();
       section.put('heading','');
       section.put('useHeading',true);
        section.put('useHeading', useHeader);
       section.put('columns',1);
       section.put('useCollapsibleSection',true);
       section.put('layoutRows',itemList);
@@ -81,10 +91,12 @@
      String layoutSectionJson = JSON.serialize(layoutSection);
      LayoutDescriberHelper.ControllerUtil();
        Test.setMock(HttpCalloutMock.class, new TestDataUtility.BaseHttpMock(layoutSectionJson,'OK','200'));
        Test.startTest();
        LayoutDescriberHelper.describeSectionWithFieldsWrapper(recordTypeId,objectType,userMode);
        LayoutDescriberHelper.describeSectionWithFieldsWrapper(null,objectType,userMode);
        LayoutDescriberHelper.describeSectionWithFields(recordTypeId, objectType, userMode);
        LayoutDescriberHelper.getLayoutSchema(recordTypeId, objectType, userMode);
        LayoutDescriberHelper.getUrlPrefix();
        Test.stopTest();
    }
}