Skip to content

Commit

Permalink
Minor updates and test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tomansley committed Dec 18, 2024
1 parent 4085de9 commit 43622e2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
12 changes: 10 additions & 2 deletions force-app/main/default/classes/ListViewActionDelete.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @description :
* @author : [email protected]
* @group :
* @last modified on : 08-07-2024
* @last modified on : 12-17-2024
* @last modified by : [email protected]
* Modifications Log
* Ver Date Author Modification
Expand All @@ -16,6 +16,12 @@ global with sharing class ListViewActionDelete extends ListViewAction {

}

/*
ListViewActionDelete d = new ListViewActionDelete();
List<String> recordIds = new List<String>();
recordIds.add('a003h00000C6MhXAAV');
d.process(recordIds, new Map<String, Object>());
*/
public override String process(List<String> recordIds, Map<String, Object> fieldValues)
{
String returnStr = ListViewAction.RESULT_OK + ':';
Expand Down Expand Up @@ -47,6 +53,8 @@ global with sharing class ListViewActionDelete extends ListViewAction {
deletedObjs.put(recordId.substringBefore(':'), obj);
}

System.debug(LoggingLevel.DEBUG, 'About to delete records');
System.debug(LoggingLevel.DEBUG, 'deletedObjs - ' + deletedObjs);
HelperDatabase.deleteRecords(deletedObjs.values());

if (deletedObjs.size() == 1)
Expand All @@ -56,7 +64,7 @@ global with sharing class ListViewActionDelete extends ListViewAction {

} catch (Exception e) {
String message = ListViewAction.RESULT_ERROR + ':There was an error deleting the ' + objType + '. Please see a system admin.';
if (ListViewConfigHelper.isDebuggingOn())
//if (ListViewConfigHelper.isDebuggingOn())
message += ' Exception during ListViewActionDelete.process() ' + ListViewException.getExtendedString(e);
ListViewErrorHelper.createFutureUsageError(message);
returnStr = message;
Expand Down
4 changes: 2 additions & 2 deletions force-app/main/default/classes/ListViewActionTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @description :
* @author : [email protected]
* @group :
* @last modified on : 02-02-2022
* @last modified on : 12-17-2024
* @last modified by : [email protected]
* Modifications Log
* Ver Date Author Modification
Expand Down Expand Up @@ -69,7 +69,7 @@ private class ListViewActionTest {

Test.startTest();

String result = ListViewController.processAction('Delete:ListViewActionDelete:Core:null', '["' + acct.Id + '"]', '[]');
String result = ListViewController.processAction('Delete:ListViewActionDelete:Core:null', '["' + acct.Id + '"]', '');

Test.stopTest();

Expand Down
22 changes: 21 additions & 1 deletion force-app/main/default/classes/ListViewConfigHelperTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @description :
* @author : [email protected]
* @group :
* @last modified on : 09-16-2024
* @last modified on : 11-26-2024
* @last modified by : [email protected]
* Modifications Log
* Ver Date Author Modification
Expand Down Expand Up @@ -64,6 +64,26 @@ private class ListViewConfigHelperTest {
System.assert(result == '');
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
//DOES NOT CONTAIN
condition.Operator__c = ListViewConfigHelper.OPER_DOES_NOT_CONTAIN;
condition.Value__c = 'Burlington';
value = 'Burlington Coat Factory';
type = ListViewHelper.TYPE_STRING;

//NEGATIVE TEST
result = ListViewConfigHelper.validateFieldCondition(value, type, condition);

System.assert(result == '');

//NEGATIVE TEST
value = 'Sterlington Coat Factory';

result = ListViewConfigHelper.validateFieldCondition(value, type, condition);

System.assert(result == HIGHLIGHT_COLOR);
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
//EQUALS
condition.Operator__c = ListViewConfigHelper.OPER_EQUAL;
Expand Down
4 changes: 2 additions & 2 deletions force-app/main/default/classes/ListViewControllerTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @description :
* @author : [email protected]
* @group :
* @last modified on : 09-17-2024
* @last modified on : 12-17-2024
* @last modified by : [email protected]
* Modifications Log
* Ver Date Author Modification
Expand Down Expand Up @@ -259,7 +259,7 @@ global class ListViewControllerTest {
System.assert(objs.size() > 0);


List<ListViewController.SelectOption> listviews = ListViewController.getObjectListViews('Account');
List<ListViewController.SelectOption> listviews = ListViewController.getObjectListViews('Account', 0);

System.assertNotEquals(listviews, null);
System.assert(listviews.size() > 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public with sharing class WebServiceListViewRequestTest {
List<ListViewController.SelectOption> options = ListViewTypeAheadController.search('schema', 'Acc', 'SObject', 'Label', 'Name', null);
System.assert(options.size() > 0);

options = ListViewTypeAheadController.search('schema', 'Contact', 'SObject', 'Label', 'Name', 'simpli_lv__Object_Name__c NOT IN [\'Contact\']');
options = ListViewTypeAheadController.search('schema', 'Contact', 'SObject', 'Label', 'Name', '[{"field":"simpli_lv__Object_Name__c","operator":"NOT IN","values":"Contact"}]');

Test.stopTest();
}
Expand Down

0 comments on commit 43622e2

Please sign in to comment.