Skip to content

Commit

Permalink
Fixed Prettier errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Triopticon committed Aug 26, 2024
1 parent e563c73 commit a518522
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
15 changes: 9 additions & 6 deletions src/platform-utility/CustomMetadataDAO/CustomMetadataDAO.cls
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* @example
* List<CustomMetadata__mdt> nameCMList = (List<CustomMetadata__mdt>) new CustomMetadataDAO()
* .getCustomMetadataRecords(
* 'SELECT MasterLable, CustomField__c ' +
* 'FROM CustomMetadata__mdt ' +
* 'SELECT MasterLable, CustomField__c ' +
* 'FROM CustomMetadata__mdt ' +
* 'WHERE DeveloperName = \'Name\''
* );
*
Expand All @@ -35,14 +35,14 @@ public class CustomMetadataDAO {

/**
* @description Get the Custom Metadata Records based on the SOQL query string provided.
*
*
* @param query The SOQL query string to fetch the Custom Metadata Records.
* @returns Return a list of Custom Metadata Records as `List<SObject>`
* @example
* List<CustomMetadata__mdt> nameCMList = (List<CustomMetadata__mdt>) new CustomMetadataDAO()
* .getCustomMetadataRecords(
* 'SELECT MasterLable, CustomField__c ' +
* 'FROM CustomMetadata__mdt ' +
* 'SELECT MasterLable, CustomField__c ' +
* 'FROM CustomMetadata__mdt ' +
* 'WHERE DeveloperName = \'Name\''
* );
*
Expand All @@ -53,7 +53,10 @@ public class CustomMetadataDAO {
*/
public List<SObject> getCustomMetadataRecords(String query) {
System.debug(LoggingLevel.DEBUG, 'query: ' + query);
System.debug(LoggingLevel.DEBUG, 'customMetadataRecordsMap: ' + customMetadataRecordsMap);
System.debug(
LoggingLevel.DEBUG,
'customMetadataRecordsMap: ' + customMetadataRecordsMap
);
if (!customMetadataRecordsMap.containsKey(query)) {
customMetadataRecordsMap.put(query, Database.query(query));
}
Expand Down
27 changes: 17 additions & 10 deletions src/platform-utility/CustomMetadataDAO/CustomMetadataDAOTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
* 'WHERE DeveloperName = \'Name\'',
* (List<CustomMetadata__mdt>) JSON.deserialize('[{"CustomField__c":"Value"}]', List<CustomMetadata__mdt>.class)
* );
*
*
* List<CustomMetadata__mdt> nameCMList = (List<CustomMetadata__mdt>) new CustomMetadataDAO()
* .getCustomMetadataRecords(
* 'SELECT MasterLable, CustomField__c ' +
* 'FROM CustomMetadata__mdt ' +
* 'SELECT MasterLable, CustomField__c ' +
* 'FROM CustomMetadata__mdt ' +
* 'WHERE DeveloperName = \'Name\''
* );
*
Expand All @@ -35,17 +35,24 @@ public class CustomMetadataDAOTest {
* @description Simple test for the getMetadata method.
*/
@IsTest
static void testGetMetadata(){
static void testGetMetadata() {
List<SObject> customMetadataRecords;
System.Test.startTest();
customMetadataRecords = new CustomMetadataDAO().getCustomMetadataRecords('SELECT MasterLabel FROM API_Base_Configuration__mdt');
customMetadataRecords = new CustomMetadataDAO()
.getCustomMetadataRecords(
'SELECT MasterLabel FROM API_Base_Configuration__mdt'
);
System.Test.stopTest();
System.assertEquals([SELECT MasterLabel FROM API_Base_Configuration__mdt].size(), customMetadataRecords.size(), 'Size should match');
System.assertEquals(
[SELECT MasterLabel FROM API_Base_Configuration__mdt].size(),
customMetadataRecords.size(),
'Size should match'
);
}

/**
* @description A utility method to set custom metadata records for the tests.
*
*
* @param query The SOQL query string to fetch the Custom Metadata Records.
* @param records Set Custom Metadata Records for the tests.
* @example
Expand All @@ -55,11 +62,11 @@ public class CustomMetadataDAOTest {
* 'WHERE DeveloperName = \'Name\'',
* (List<CustomMetadata__mdt>) JSON.deserialize('[{"CustomField__c":"Value"}]', List<CustomMetadata__mdt>.class)
* );
*
*
* List<CustomMetadata__mdt> nameCMList = (List<CustomMetadata__mdt>) new CustomMetadataDAO()
* .getCustomMetadataRecords(
* 'SELECT MasterLable, CustomField__c ' +
* 'FROM CustomMetadata__mdt ' +
* 'SELECT MasterLable, CustomField__c ' +
* 'FROM CustomMetadata__mdt ' +
* 'WHERE DeveloperName = \'Name\''
* );
*
Expand Down
4 changes: 2 additions & 2 deletions src/platform-utility/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Package containing the core platform utilities.

The package can only contain utilities that are used by the sf-platform, and can be used by any other re.
The package can only contain utilities that are used by the sf-platform, and can be used by any other re.

## Maintainer

Expand All @@ -14,4 +14,4 @@ Spørsmål knyttet til koden eller prosjektet kan stilles som issues her på Git

### For NAV-ansatte

Interne henvendelser kan sendes via Slack i kanalen #platforce.
Interne henvendelser kan sendes via Slack i kanalen #platforce.

0 comments on commit a518522

Please sign in to comment.