From 7bc6d0f50f5099a26da6ad1d53e1de86188e5e2c Mon Sep 17 00:00:00 2001 From: Akansha Sakhre Date: Thu, 8 Aug 2024 21:44:29 +0530 Subject: [PATCH] fixed test cases --- .../CollectionList/CollectionList.test.tsx | 20 ++++++++++++---- .../AdminContactManagement.tsx | 2 +- .../ContactManagement.test.tsx | 2 +- .../SuperAdminContactManagement.tsx | 2 +- .../UploadContactsDialog.module.css | 10 ++++++++ .../UploadContactsDialog.test.tsx | 23 +++++++++++++++---- .../UploadContactsDialog.tsx | 12 ++++++---- src/i18n/en/en.json | 2 +- src/mocks/Collection.tsx | 16 +++---------- 9 files changed, 58 insertions(+), 31 deletions(-) diff --git a/src/containers/Collection/CollectionList/CollectionList.test.tsx b/src/containers/Collection/CollectionList/CollectionList.test.tsx index e2b23ecd0a..cc8a4f1078 100644 --- a/src/containers/Collection/CollectionList/CollectionList.test.tsx +++ b/src/containers/Collection/CollectionList/CollectionList.test.tsx @@ -25,16 +25,28 @@ import { updateCollectionWaGroupQuery, } from 'mocks/Groups'; import { setNotification } from 'common/notification'; -import { setVariables } from 'common/constants'; +import { CONTACTS_COLLECTION, setVariables } from 'common/constants'; import { setUserRolePermissions } from 'context/role'; +const variables = { + filter: { + groupType: CONTACTS_COLLECTION, + }, + opts: { + limit: 50, + offset: 0, + order: 'ASC', + orderWith: 'label', + }, +}; + const mocks = [ countCollectionQuery, countCollectionQuery, countCollectionQuery, - filterCollectionQuery, - filterCollectionQuery, - filterCollectionQuery, + filterCollectionQuery(variables), + filterCollectionQuery(variables), + filterCollectionQuery(variables), getPublishedFlowQuery, getPublishedFlowQuery, getCollectionContactsQuery, diff --git a/src/containers/ContactManagement/AdminContactManagement/AdminContactManagement.tsx b/src/containers/ContactManagement/AdminContactManagement/AdminContactManagement.tsx index 5ee1fde063..82b88caa2c 100644 --- a/src/containers/ContactManagement/AdminContactManagement/AdminContactManagement.tsx +++ b/src/containers/ContactManagement/AdminContactManagement/AdminContactManagement.tsx @@ -120,7 +120,7 @@ export const AdminContactManagement = () => {
-
+
{ setImporting(true); }} - afterImport={(result: string) => { - setImporting(false); + afterImport={(result: string, media: any) => { + setFileName(media.name); setCsvContent(result); + setImporting(false); }} />
diff --git a/src/i18n/en/en.json b/src/i18n/en/en.json index ec7930c355..09ea81d46a 100644 --- a/src/i18n/en/en.json +++ b/src/i18n/en/en.json @@ -155,7 +155,7 @@ "Contact Variables": "Contact Variables", "Back to flows": "Back to flows", "Contacts have been updated": "Contacts have been updated", - "Upload contacts": "Upload contacts", + "Upload Contacts": "Upload Contacts", "Contact management": "Contact management", "Contacts have been uploaded": "Contacts have been uploaded", "Collection is required": "Collection is required", diff --git a/src/mocks/Collection.tsx b/src/mocks/Collection.tsx index 1b7d6402d1..f99f918d93 100644 --- a/src/mocks/Collection.tsx +++ b/src/mocks/Collection.tsx @@ -227,20 +227,10 @@ export const countCollectionQuery = { }, }; -export const filterCollectionQuery = { +export const filterCollectionQuery = (variables: any) => ({ request: { query: FILTER_COLLECTIONS, - variables: { - filter: { - groupType: CONTACTS_COLLECTION, - }, - opts: { - limit: 50, - offset: 0, - order: 'ASC', - orderWith: 'label', - }, - }, + variables, }, result: { data: { @@ -257,7 +247,7 @@ export const filterCollectionQuery = { ], }, }, -}; +}); export const filterCollectionQueryWAGroups = { request: {