@capillarytech/creatives-library 8.0.331 → 8.0.332
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/services/api.js +17 -0
- package/services/tests/api.test.js +72 -0
- package/utils/commonUtils.js +10 -0
- package/utils/tests/commonUtil.test.js +169 -0
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +42 -0
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +155 -0
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +94 -0
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +78 -49
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +134 -34
- package/v2Components/CommonTestAndPreview/actions.js +10 -0
- package/v2Components/CommonTestAndPreview/constants.js +17 -1
- package/v2Components/CommonTestAndPreview/index.js +356 -22
- package/v2Components/CommonTestAndPreview/messages.js +106 -0
- package/v2Components/CommonTestAndPreview/reducer.js +12 -0
- package/v2Components/CommonTestAndPreview/sagas.js +2 -1
- package/v2Components/CommonTestAndPreview/tests/AddTestCustomer.test.js +66 -0
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +648 -0
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +23 -5
- package/v2Components/CommonTestAndPreview/tests/CustomerCreationModal.test.js +174 -0
- package/v2Components/CommonTestAndPreview/tests/ExistingCustomerModal.test.js +114 -0
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +39 -19
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +31 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +36 -0
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +71 -0
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +17 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +1408 -1276
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +321 -288
- package/v2Containers/TagList/index.js +11 -15
- package/v2Containers/WebPush/Create/index.js +1 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +5246 -4872
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for AddTestCustomerButton Component
|
|
3
|
+
*
|
|
4
|
+
* The parent (index.js) only renders this button when channel is EMAIL/SMS and value is valid.
|
|
5
|
+
* This component always renders the button when mounted; visibility is the parent's responsibility.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
10
|
+
import { IntlProvider } from 'react-intl';
|
|
11
|
+
import AddTestCustomerButton from '../AddTestCustomer';
|
|
12
|
+
|
|
13
|
+
const mockMessages = {
|
|
14
|
+
'app.v2Components.TestAndPreviewSlidebox.addTestCustomerWithValue': 'Add {searchValue} as Test Customer',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const TestWrapper = ({ children }) => (
|
|
18
|
+
<IntlProvider locale="en" messages={mockMessages}>
|
|
19
|
+
{children}
|
|
20
|
+
</IntlProvider>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
describe('AddTestCustomerButton', () => {
|
|
24
|
+
const defaultProps = {
|
|
25
|
+
searchValue: 'user@example.com',
|
|
26
|
+
handleAddTestCustomer: jest.fn(),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
jest.clearAllMocks();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should render button with searchValue in message', () => {
|
|
34
|
+
render(
|
|
35
|
+
<TestWrapper>
|
|
36
|
+
<AddTestCustomerButton {...defaultProps} />
|
|
37
|
+
</TestWrapper>
|
|
38
|
+
);
|
|
39
|
+
const button = screen.getByRole('button', { name: /add.*test customer/i });
|
|
40
|
+
expect(button).toBeTruthy();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should show searchValue in button text', () => {
|
|
44
|
+
render(
|
|
45
|
+
<TestWrapper>
|
|
46
|
+
<AddTestCustomerButton {...defaultProps} searchValue="user@example.com" />
|
|
47
|
+
</TestWrapper>
|
|
48
|
+
);
|
|
49
|
+
expect(screen.getByRole('button', { name: /user@example.com/i })).toBeTruthy();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should call handleAddTestCustomer when button is clicked', () => {
|
|
53
|
+
const handleAddTestCustomer = jest.fn();
|
|
54
|
+
render(
|
|
55
|
+
<TestWrapper>
|
|
56
|
+
<AddTestCustomerButton
|
|
57
|
+
searchValue="user@example.com"
|
|
58
|
+
handleAddTestCustomer={handleAddTestCustomer}
|
|
59
|
+
/>
|
|
60
|
+
</TestWrapper>
|
|
61
|
+
);
|
|
62
|
+
const button = screen.getByRole('button', { name: /add.*test customer/i });
|
|
63
|
+
fireEvent.click(button);
|
|
64
|
+
expect(handleAddTestCustomer).toHaveBeenCalledTimes(1);
|
|
65
|
+
});
|
|
66
|
+
});
|