Skip to content

Commit

Permalink
[WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
jongpie committed Oct 15, 2024
1 parent 2fc4d05 commit c973721
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -830,15 +830,15 @@ public class LoggerParameter {

private static Map<String, LoggerParameter__mdt> loadRecords() {
Map<String, LoggerParameter__mdt> parameters = LoggerConfigurationDataSelector.getInstance().getLoggerParameters();
// DELETEME remove this in a future release - only Nebula Logger's own tests should use mocks,
// but org tests should actually load the records from the database
if (System.Test.isRunningTest()) {
// Keep a copy of any records that *should* be loaded during tests
// Currently, only the record `SystemDebugMessageFormat` has a use case for this functionality,
// but others can be easily added if other use cases are found
Map<String, LoggerParameter__mdt> parametersToLoadDuringTests = new Map<String, LoggerParameter__mdt>();
for (String testContextParameterName : PARAMETERS_TO_LOAD_DURING_TESTS) {
if (parameters.containsKey(testContextParameterName)) {
parametersToLoadDuringTests.put(testContextParameterName, parameters.get(testContextParameterName));
}
parametersToLoadDuringTests.put(testContextParameterName, LoggerParameter__mdt.getInstance(testContextParameterName));
}
parameters.clear();
parameters.putAll(parametersToLoadDuringTests);
Expand Down

0 comments on commit c973721

Please sign in to comment.