You need to sign in to do that
Don't have an account?
Raffus
How to write a test class for below method
@AuraEnabled public static String loadData(String strCaseInfo) { System.debug('caseInfo ' + strCaseInfo); CaseInfoWrapper caseInfo = (CaseInfoWrapper)JSON.deserialize(strCaseInfo, CaseInfoWrapper.class); rand_App_Customer__c customer = getCustomerInfo2(caseInfo.emailId); Case cse = new Case(); cse.subject = 'tan One Problem Report'; cse.Origin = rand_APP; cse.Status = 'Awaiting Approval'; cse.Priority = 'Medium'; cse.RecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByDeveloperName().get(rand_APP).getRecordTypeId(); cse.Description = caseInfo.description; cse.rand_App_Customer__c = customer?.Id; cse.Issue_category__c = caseInfo.category; cse.Issue_Sub_Category__c = caseInfo.subCategory; insert cse; // for skip the triggers of ContentDocumentLink && ContentDocument ContentDocumentLinkTriggerUtil.skipTrigger = true; ContentDocumentTriggerUtil.skipTrigger = true; List<ContentVersion> cVersions = new List<ContentVersion>(); for (FileInfoWrapper file : caseInfo.files) { System.debug('fileInfo ' + file); if (String.isNotBlank(file.base64Data)) { ContentVersion cv = new ContentVersion(); cv.ContentLocation = 'S'; cv.PathOnClient = file.fileName; cv.VersionData = EncodingUtil.base64Decode(file.base64Data); cv.Title = file.fileName; cVersions.add(cv); } }
It would be difficult for the community to provide the complete implementation of test class. However, we can help you with errors if you face any in your test code.
Thanks & Regards,
Priya Ranjan
On this line - CaseInfoWrapper caseInfo = (CaseInfoWrapper)JSON.deserialize(strCaseInfo, CaseInfoWrapper.class);