-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stabilize Test Runs for Orgs without Trigger Factory Settings and wit…
…hout Record Type Filters (#7) * Stabilize Test Runs for Orgs without Trigger Factory Settings and without Record Type Filters. Make package-specific tests only run during package version creation. * Increment Package Version after opened Pull Request * Update Package Version sfdx-project.json, README and Installation Docs Co-authored-by: Dennis Grzyb <dennis.grzyb@outlook.com> Co-authored-by: GitHub Action Bot <action@github.com>
- Loading branch information
1 parent
0faf21b
commit 57cc00d
Showing
8 changed files
with
105 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
@isTest | ||
public with sharing class TriggerMappingTest { | ||
private static String factoryDummyValues = '[{"Label":"Account_Person","MasterLabel":"Account_Person","ClassName__c":"PersonAccountHandler","Language":"en_US","RecordTypeIds__c":"0121X000003twHvQAI","IsDisabled__c":false,"QualifiedApiName":"Account_Person","SObjectName__c":"Account","Id":"m005E0000002NLS","OrderOfExecution__c":1,"DeveloperName":"Account_Person","NamespacePrefix":null}]'; | ||
@isTest | ||
static void getTriggerMap() { | ||
//It is a given that we have at least one Custom Metadata Type in the Trigger Factory Setting (e.g. the Dummy Object from this pkg) | ||
//Therefore we only need to initialize the Map | ||
//Since we got rid of unmanaged metadata in our package, we are now verifying the existence of mapped Handlers by mocking an active Handler with a Record Type Filter. | ||
TriggerMapping.triggerFactorySettings = (List<TriggerFactorySetting__mdt>) JSON.deserialize(factoryDummyValues, List<TriggerFactorySetting__mdt>.class); | ||
|
||
TriggerMapping trigMap = TriggerMapping.getInstance(); | ||
System.assert(trigMap.mappedHandlers.size() > 0); | ||
System.assert(trigMap.mappedHandlers.size() == 1); | ||
|
||
//DummyObject2 was previously part of the unmanaged metadata, but is auto-excluded here because it does not come up in a query where IsDisabled__c = false | ||
|
||
//Additionally DummyObject2 should not come up in this instance, because it is disabled. | ||
System.assert(!trigMap.mappedHandlers.containsKey('DUMMYOBJECT2')); | ||
|
||
System.assert(trigMap.recordTypeFilter.containsKey('PersonAccountHandler')); | ||
} | ||
|
||
@isTest | ||
static void getTriggerMapWhenTriggerFactorySettingsExist() { | ||
if ([SELECT COUNT() FROM TriggerFactorySetting__mdt] != 0) { | ||
TriggerMapping.getInstance(); | ||
} | ||
} | ||
} |