Skip to content

Commit

Permalink
test(quantic): added new apex class test to increase code coverage (#…
Browse files Browse the repository at this point in the history
…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
mmitiche authored Sep 25, 2024
1 parent c6393a9 commit b595d0d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
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');
}
}
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>

0 comments on commit b595d0d

Please sign in to comment.