-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from SFDO-Community/feature-ccipkg1
Feature ccipkg1
- Loading branch information
Showing
45 changed files
with
550 additions
and
103 deletions.
There are no files selected for viewing
File renamed without changes.
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 |
---|---|---|
|
@@ -46,3 +46,5 @@ tempdata-out | |
.pmdCache | ||
.vscode/* | ||
.vscode/settings.json | ||
test_results.json | ||
test_results.xml |
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
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/GGW_ApplicationCtrl.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
242 changes: 230 additions & 12 deletions
242
force-app/main/default/classes/GGW_ApplicationCtrlTest.cls
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/GGW_ApplicationCtrlTest.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/GGW_ApplicationSelector.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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 |
---|---|---|
|
@@ -26,9 +26,36 @@ | |
*/ | ||
@isTest | ||
private class GGW_ApplicationSelectorTest { | ||
@TestSetup | ||
static void makeData(){ | ||
|
||
String uniqueUserName = 'grantuser' + DateTime.now().getTime() + '@labsorg.com'; | ||
// This code runs as the system user | ||
Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; | ||
|
||
PermissionSet ps = [SELECT Id FROM PermissionSet WHERE Name = 'GGW_User_Permissions']; | ||
|
||
User u = new User(Alias = 'standt', Email='[email protected]', | ||
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', | ||
LocaleSidKey='en_US', ProfileId = p.Id, | ||
TimeZoneSidKey='America/Los_Angeles', | ||
UserName=uniqueUserName); | ||
insert u; | ||
|
||
insert new PermissionSetAssignment(AssigneeId = u.id, PermissionSetId = ps.Id); | ||
} | ||
@isTest | ||
static void testQueryGrantApp(){ | ||
// This code runs as the Grant Guide User with GGW Permission Set from the TestSetup makeData() method. | ||
User u = [SELECT Alias, Email, EmailEncodingKey, LastName, LanguageLocaleKey, | ||
LocaleSidKey, ProfileId, TimeZoneSidKey, UserName | ||
FROM User WHERE Email = '[email protected]' AND Alias='standt' LIMIT 1]; | ||
|
||
System.runAs(u) { | ||
|
||
//Create sample data | ||
GGW_TestDataFactory.createGrantContentTestData(); | ||
|
||
// Query all suggested sections | ||
List<GGW_SectionWrapper> lst = GGW_ApplicationCtrl.getSections(); | ||
List<String> sections = new List<String>(); | ||
|
@@ -43,10 +70,20 @@ private class GGW_ApplicationSelectorTest { | |
GGW_Grant_Application__c grant = GGW_ApplicationSelector.queryGrantApp(app.Id); | ||
Test.stopTest(); | ||
System.assertEquals(grant.Name, 'Grant App', 'Could not create a new grant application'); | ||
|
||
} | ||
} | ||
@isTest | ||
static void getGrantApplicationsTest(){ | ||
// This code runs as the Grant Guide User with GGW Permission Set from the TestSetup makeData() method. | ||
User u = [SELECT Alias, Email, EmailEncodingKey, LastName, LanguageLocaleKey, | ||
LocaleSidKey, ProfileId, TimeZoneSidKey, UserName | ||
FROM User WHERE Email = '[email protected]' AND Alias='standt' LIMIT 1]; | ||
|
||
System.runAs(u) { | ||
|
||
//Create sample data | ||
GGW_TestDataFactory.createGrantContentTestData(); | ||
|
||
// Query all suggested sections | ||
List<GGW_SectionWrapper> lst = GGW_ApplicationCtrl.getSections(); | ||
List<String> sections = new List<String>(); | ||
|
@@ -63,5 +100,6 @@ private class GGW_ApplicationSelectorTest { | |
List<GGW_Grant_Application__c> grantList = GGW_ApplicationSelector.getGrantApplications(); | ||
Test.stopTest(); | ||
System.assertEquals(2, grantList.size(), 'Query grant application invalid'); | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/GGW_ApplicationSelectorTest.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/GGW_ContentBlockSelector.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/GGW_ContentBlockWrapper.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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 |
---|---|---|
|
@@ -11,12 +11,36 @@ | |
public class GGW_ContentBlockWrapperTest { | ||
@TestSetup | ||
static void makeData(){ | ||
// Samlple content data for testing methods | ||
GGW_TestDataFactory.createGrantContentTestData(); | ||
|
||
String uniqueUserName = 'grantuser' + DateTime.now().getTime() + '@labsorg.com'; | ||
// This code runs as the system user | ||
Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; | ||
|
||
PermissionSet ps = [SELECT Id FROM PermissionSet WHERE Name = 'GGW_User_Permissions']; | ||
|
||
User u = new User(Alias = 'standt', Email='[email protected]', | ||
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', | ||
LocaleSidKey='en_US', ProfileId = p.Id, | ||
TimeZoneSidKey='America/Los_Angeles', | ||
UserName=uniqueUserName); | ||
insert u; | ||
|
||
insert new PermissionSetAssignment(AssigneeId = u.id, PermissionSetId = ps.Id); | ||
} | ||
|
||
@isTest | ||
static void testBlockWrapperConstructors(){ | ||
|
||
// This code runs as the Grant Guide User with GGW Permission Set from the TestSetup makeData() method. | ||
User u = [SELECT Alias, Email, EmailEncodingKey, LastName, LanguageLocaleKey, | ||
LocaleSidKey, ProfileId, TimeZoneSidKey, UserName | ||
FROM User WHERE Email = '[email protected]' AND Alias='standt' LIMIT 1]; | ||
|
||
System.runAs(u) { | ||
|
||
//Create sample data | ||
GGW_TestDataFactory.createGrantContentTestData(); | ||
|
||
List<GGW_Content_Block__c> cbList = [SELECT Id, Name, Description__c, Short_Description__c, | ||
Section__c, Section__r.Name, CreatedDate, | ||
Language__c | ||
|
@@ -33,6 +57,7 @@ public class GGW_ContentBlockWrapperTest { | |
System.assertEquals(2, textBlock.totalblocks, 'Expected total block 2 did not match'); | ||
System.assertEquals(firstBlock.Name, textBlock.title, 'Expected block name to tile did not match'); | ||
System.assertEquals(firstBlock.Section__c, textBlock.sectionid, 'Block parent section not valid'); | ||
} | ||
} | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/GGW_ContentBlockWrapperTest.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/GGW_ContentSelector.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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 |
---|---|---|
|
@@ -12,13 +12,36 @@ | |
public class GGW_ExportCtrlTest { | ||
@TestSetup | ||
static void makeData(){ | ||
// Create test sections | ||
// Samlple content data for testing methods | ||
GGW_TestDataFactory.createGrantContentTestData(); | ||
|
||
String uniqueUserName = 'grantuser' + DateTime.now().getTime() + '@labsorg.com'; | ||
// This code runs as the system user | ||
Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; | ||
|
||
PermissionSet ps = [SELECT Id FROM PermissionSet WHERE Name = 'GGW_User_Permissions']; | ||
|
||
User u = new User(Alias = 'standt', Email='[email protected]', | ||
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', | ||
LocaleSidKey='en_US', ProfileId = p.Id, | ||
TimeZoneSidKey='America/Los_Angeles', | ||
UserName=uniqueUserName); | ||
insert u; | ||
|
||
insert new PermissionSetAssignment(AssigneeId = u.id, PermissionSetId = ps.Id); | ||
} | ||
|
||
@isTest | ||
static void testExportCtrl(){ | ||
|
||
// This code runs as the Grant Guide User with GGW Permission Set from the TestSetup makeData() method. | ||
User u = [SELECT Alias, Email, EmailEncodingKey, LastName, LanguageLocaleKey, | ||
LocaleSidKey, ProfileId, TimeZoneSidKey, UserName | ||
FROM User WHERE Email = '[email protected]' AND Alias='standt' LIMIT 1]; | ||
|
||
System.runAs(u) { | ||
|
||
//Create sample data | ||
GGW_TestDataFactory.createGrantContentTestData(); | ||
|
||
// Unit test for conroller extention when used as part of record page context | ||
// Query all suggested sections | ||
List<GGW_SectionWrapper> lst = GGW_ApplicationCtrl.getSections(); | ||
|
@@ -41,10 +64,22 @@ public class GGW_ExportCtrlTest { | |
System.assertEquals(app.Name, grantExportController.appName, 'Grant name selected for export does not exist - MyTest Grant'); | ||
// 3 section expected to be added to grand | ||
System.assertEquals(3, grantExportController.items.size(), 'Grant expected 3 items for export, size did not match test.'); | ||
} | ||
} | ||
} | ||
|
||
@isTest | ||
static void testExportWithPage(){ | ||
|
||
// This code runs as the Grant Guide User with GGW Permission Set from the TestSetup makeData() method. | ||
User u = [SELECT Alias, Email, EmailEncodingKey, LastName, LanguageLocaleKey, | ||
LocaleSidKey, ProfileId, TimeZoneSidKey, UserName | ||
FROM User WHERE Email = '[email protected]' AND Alias='standt' LIMIT 1]; | ||
|
||
System.runAs(u) { | ||
|
||
//Create sample data | ||
GGW_TestDataFactory.createGrantContentTestData(); | ||
|
||
// Unit test for conroller extention when NOT Record page but pass parameter recordId | ||
// Query all suggested sections | ||
List<GGW_SectionWrapper> lst = GGW_ApplicationCtrl.getSections(); | ||
|
@@ -70,5 +105,6 @@ public class GGW_ExportCtrlTest { | |
|
||
System.assertEquals(null, grantExportController.recordId, 'Negative test with empty Grant for export expected null value'); | ||
System.assertEquals('This view requires a Grant record, missing.', grantExportController.appName, 'Negative test empty Grant expect missing name error message'); | ||
} | ||
} | ||
} |
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/GGW_GrantApplicationWrapper.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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 |
---|---|---|
|
@@ -11,13 +11,34 @@ | |
public class GGW_GrantApplicationWrapperTest { | ||
@TestSetup | ||
static void makeData(){ | ||
// Samlple content data for testing methods | ||
GGW_TestDataFactory.createGrantContentTestData(); | ||
|
||
String uniqueUserName = 'grantuser' + DateTime.now().getTime() + '@labsorg.com'; | ||
// This code runs as the system user | ||
Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; | ||
|
||
PermissionSet ps = [SELECT Id FROM PermissionSet WHERE Name = 'GGW_User_Permissions']; | ||
|
||
User u = new User(Alias = 'standt', Email='[email protected]', | ||
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', | ||
LocaleSidKey='en_US', ProfileId = p.Id, | ||
TimeZoneSidKey='America/Los_Angeles', | ||
UserName=uniqueUserName); | ||
insert u; | ||
|
||
insert new PermissionSetAssignment(AssigneeId = u.id, PermissionSetId = ps.Id); | ||
|
||
} | ||
|
||
@isTest | ||
static void testGrantApplicationWrapperConstructor(){ | ||
|
||
// This code runs as the Grant Guide User with GGW Permission Set from the TestSetup makeData() method. | ||
User u = [SELECT Alias, Email, EmailEncodingKey, LastName, LanguageLocaleKey, | ||
LocaleSidKey, ProfileId, TimeZoneSidKey, UserName | ||
FROM User WHERE Email = '[email protected]' AND Alias='standt' LIMIT 1]; | ||
System.runAs(u) { | ||
// Samlple content data for testing methods | ||
GGW_TestDataFactory.createGrantContentTestData(); | ||
Test.startTest(); | ||
GGW_GrantApplicationWrapper app = new GGW_GrantApplicationWrapper(); | ||
app.name = 'Test Grant'; | ||
|
@@ -28,5 +49,6 @@ public class GGW_GrantApplicationWrapperTest { | |
Test.stopTest(); | ||
|
||
System.assertNotEquals(null, app, 'Default constructor faild to create wrapper grant object'); | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
force-app/main/default/classes/GGW_GrantApplicationWrapperTest.cls-meta.xml
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> | ||
</ApexClass> |
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,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>60.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
Oops, something went wrong.