From b595d0de8890d2ec2564a6c870242457000a3b97 Mon Sep 17 00:00:00 2001 From: mmitiche <86681870+mmitiche@users.noreply.github.com> Date: Wed, 25 Sep 2024 16:01:35 -0400 Subject: [PATCH] test(quantic): added new apex class test to increase code coverage (#4464) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [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: Screenshot 2024-09-25 at 2 57 08 PM ### After: Screenshot 2024-09-25 at 2 57 22 PM [SFINT-5738]: https://coveord.atlassian.net/browse/SFINT-5738?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- .../classes/OrganizationEndpointsTest.cls | 55 +++++++++++++++++++ .../OrganizationEndpointsTest.cls-meta.xml | 5 ++ 2 files changed, 60 insertions(+) create mode 100644 packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.cls create mode 100644 packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.cls-meta.xml diff --git a/packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.cls b/packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.cls new file mode 100644 index 00000000000..0fe7faeae34 --- /dev/null +++ b/packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.cls @@ -0,0 +1,55 @@ +@isTest +public class OrganizationEndpointsTest { + @isTest + static void testGetOrganizationEndpointsWithProdEnv() { + String orgId = 'testOrgId'; + String env = 'prod'; + + Map 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 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 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'); + } +} diff --git a/packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.cls-meta.xml b/packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.cls-meta.xml new file mode 100644 index 00000000000..7d5f9e8a396 --- /dev/null +++ b/packages/quantic/force-app/main/default/classes/OrganizationEndpointsTest.cls-meta.xml @@ -0,0 +1,5 @@ + + + 61.0 + Active + \ No newline at end of file