-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(quantic): added new apex class test to increase code coverage (#…
…4464) [SFINT-5738](https://coveord.atlassian.net/browse/SFINT-5738) - This should allow reaching more than 75% of test code coverage allowing the promotion of new Quantic versions. PS: These images were made using dummy package: ### Before: <img width="400" alt="Screenshot 2024-09-25 at 2 57 08 PM" src="https://github.com/user-attachments/assets/af4035e8-0add-4f60-a532-8dc63488ab6d"> ### After: <img width="400" alt="Screenshot 2024-09-25 at 2 57 22 PM" src="https://github.com/user-attachments/assets/9e65388d-0cb8-4879-9fd3-6d05c075eca0"> [SFINT-5738]: https://coveord.atlassian.net/browse/SFINT-5738?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.cls
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
@isTest | ||
public class OrganizationEndpointsTest { | ||
@isTest | ||
static void testGetOrganizationEndpointsWithProdEnv() { | ||
String orgId = 'testOrgId'; | ||
String env = 'prod'; | ||
|
||
Map<String, String> endpoints = OrganizationEndpoints.getOrganizationEndpoints(orgId, env); | ||
|
||
String expectedPlatform = 'https://testOrgId.org.coveo.com'; | ||
String expectedAnalytics = 'https://testOrgIdanalytics.org.coveo.com'; | ||
String expectedSearch = expectedPlatform + '/rest/search/v2'; | ||
String expectedAdmin = 'https://testOrgIdadmin.org.coveo.com'; | ||
|
||
System.assertEquals(expectedPlatform, endpoints.get('platform'), 'Platform URL mismatch for prod'); | ||
System.assertEquals(expectedAnalytics, endpoints.get('analytics'), 'Analytics URL mismatch for prod'); | ||
System.assertEquals(expectedSearch, endpoints.get('search'), 'Search URL mismatch for prod'); | ||
System.assertEquals(expectedAdmin, endpoints.get('admin'), 'Admin URL mismatch for prod'); | ||
} | ||
|
||
@isTest | ||
static void testGetOrganizationEndpointsWithNonProdEnv() { | ||
String orgId = 'testOrgId'; | ||
String env = 'dev'; | ||
|
||
Map<String, String> endpoints = OrganizationEndpoints.getOrganizationEndpoints(orgId, env); | ||
|
||
String expectedPlatform = 'https://testOrgId.orgdev.coveo.com'; | ||
String expectedAnalytics = 'https://testOrgIdanalytics.orgdev.coveo.com'; | ||
String expectedSearch = expectedPlatform + '/rest/search/v2'; | ||
String expectedAdmin = 'https://testOrgIdadmin.orgdev.coveo.com'; | ||
|
||
System.assertEquals(expectedPlatform, endpoints.get('platform'), 'Platform URL mismatch for dev'); | ||
System.assertEquals(expectedAnalytics, endpoints.get('analytics'), 'Analytics URL mismatch for dev'); | ||
System.assertEquals(expectedSearch, endpoints.get('search'), 'Search URL mismatch for dev'); | ||
System.assertEquals(expectedAdmin, endpoints.get('admin'), 'Admin URL mismatch for dev'); | ||
} | ||
|
||
@isTest | ||
static void testGetOrganizationEndpointsWithoutEnv() { | ||
String orgId = 'testOrgId'; | ||
|
||
Map<String, String> endpoints = OrganizationEndpoints.getOrganizationEndpoints(orgId); | ||
|
||
String expectedPlatform = 'https://testOrgId.org.coveo.com'; | ||
String expectedAnalytics = 'https://testOrgIdanalytics.org.coveo.com'; | ||
String expectedSearch = expectedPlatform + '/rest/search/v2'; | ||
String expectedAdmin = 'https://testOrgIdadmin.org.coveo.com'; | ||
|
||
System.assertEquals(expectedPlatform, endpoints.get('platform'), 'Platform URL mismatch'); | ||
System.assertEquals(expectedAnalytics, endpoints.get('analytics'), 'Analytics URL mismatch'); | ||
System.assertEquals(expectedSearch, endpoints.get('search'), 'Search URL mismatch'); | ||
System.assertEquals(expectedAdmin, endpoints.get('admin'), 'Admin URL mismatch'); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>61.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |