From eeb7c0a2d6f037d515bb822d739036b69c4dc73a Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期五, 08 四月 2022 17:14:12 +0800
Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG

---
 force-app/main/default/classes/LayoutDescriberHelperTest.cls |   90 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/LayoutDescriberHelperTest.cls b/force-app/main/default/classes/LayoutDescriberHelperTest.cls
new file mode 100644
index 0000000..2915d9a
--- /dev/null
+++ b/force-app/main/default/classes/LayoutDescriberHelperTest.cls
@@ -0,0 +1,90 @@
+@isTest
+private class LayoutDescriberHelperTest {
+    static testMethod void testMethod1() {
+    	String userMode = 'classic';//classic  lightning
+    	String objectType = 'Contact';
+    	String recordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Doctor').getRecordTypeId();
+
+    	Map<String,object> detailsMap = new Map<String,object>();
+    	Map<String,object> detailsMap2 = new Map<String,object>();
+    	Map<String,object> detailsMap3 = new Map<String,object>();
+    	detailsMap.put('calculated',true);
+    	detailsMap.put('autoNumber',false);
+    	detailsMap.put('type','address');
+    	detailsMap2.put('calculated',false);
+    	detailsMap2.put('autoNumber',false);
+    	detailsMap2.put('type','repair');
+    	detailsMap3.put('calculated',false);
+    	detailsMap3.put('autoNumber',false);
+    	detailsMap3.put('type','repair');
+
+    	List<Map<String, object>> componentMapList = new List<Map<String, object>>();
+    	List<Map<String, object>> componentMapList2 = new List<Map<String, object>>();
+    	List<Map<String, object>> componentMapList3 = new List<Map<String, object>>();
+    	Map<String, object> componentMap = new Map<String, object>();
+    	Map<String, object> componentMap2 = new Map<String, object>();
+    	Map<String, object> componentMap3 = new Map<String, object>();
+    	componentMap.put('value','Name');
+    	componentMap.put('type','Field');
+    	componentMap.put('details',detailsMap);
+    	componentMapList.add(componentMap);
+    	componentMap2.put('value','Name');
+    	componentMap2.put('type','Field');
+    	componentMap2.put('details',detailsMap2);
+    	componentMapList2.add(componentMap2);
+    	componentMap3.put('value','LastName');
+    	componentMap3.put('type','Field');
+    	componentMap3.put('details',detailsMap3);
+    	componentMapList3.add(componentMap3);
+
+    	List<Map<String, object>> layoutComponentsList = new List<Map<String, object>>();
+    	Map<String, object> layoutComponents = new Map<String, object>();
+    	layoutComponents.put('layoutComponents',componentMapList);
+    	layoutComponents.put('label','Address');
+    	layoutComponents.put('placeholder',true);
+    	layoutComponents.put('editableForNew',true);
+    	layoutComponents.put('required',false);
+    	layoutComponentsList.add(layoutComponents);
+    	Map<String, object> layoutComponents2 = new Map<String, object>();
+    	layoutComponents2.put('layoutComponents',componentMapList2);
+    	layoutComponents2.put('label','Repair');
+    	layoutComponents2.put('placeholder',true);
+    	layoutComponents2.put('editableForNew',true);
+    	layoutComponents2.put('required',false);
+    	layoutComponentsList.add(layoutComponents2);
+    	Map<String, object> layoutComponents3 = new Map<String, object>();
+    	layoutComponents3.put('layoutComponents',componentMapList3);
+    	layoutComponents3.put('label','Repair');
+    	layoutComponents3.put('placeholder',true);
+    	layoutComponents3.put('editableForNew',true);
+    	layoutComponents3.put('required',false);
+    	layoutComponentsList.add(layoutComponents3);
+
+
+    	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);
+    	
+    	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('columns',1);
+    	section.put('useCollapsibleSection',true);
+    	section.put('layoutRows',itemList);
+    	sectionList.add(section);
+
+		Map<String, Object> layoutSection = new Map<String,Object>();
+    	layoutSection.put('layouts','123');
+    	layoutSection.put('editLayoutSections',sectionList);
+		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);
+        Test.stopTest();
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1