@capillarytech/creatives-library 7.17.35-alpha.2 → 7.17.36
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/containers/Templates/actions.js +0 -5
- package/index.js +6 -0
- package/package.json +1 -1
- package/routes.js +5 -0
- package/services/api.js +6 -1
- package/utils/common.js +0 -5
- package/v2Components/CapTagList/index.js +4 -0
- package/v2Components/WhatsappStatusContainer/_whatsappStatusContainer.scss +2 -1
- package/v2Containers/App/constants.js +1 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +13 -0
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +9 -6
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/index.scss +3 -0
- package/v2Containers/CreativesContainer/messages.js +8 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +6 -1
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +58 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +18114 -88
- package/v2Containers/Templates/_templates.scss +20 -2
- package/v2Containers/Templates/actions.js +4 -3
- package/v2Containers/Templates/constants.js +2 -1
- package/v2Containers/Templates/index.js +319 -120
- package/v2Containers/Templates/messages.js +28 -8
- package/v2Containers/Templates/reducer.js +3 -1
- package/v2Containers/Templates/sagas.js +2 -2
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +724 -43
- package/v2Containers/Templates/tests/actions.test.js +18 -0
- package/v2Containers/Templates/tests/index.test.js +52 -1
- package/v2Containers/Templates/tests/mockData.js +41 -1
- package/v2Containers/Templates/tests/reducer.test.js +50 -0
- package/v2Containers/Templates/tests/sagas.test.js +40 -2
- package/v2Containers/Templates/tests/selector.test.js +17 -0
- package/v2Containers/TemplatesV2/index.js +2 -2
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/Zalo/actions.js +17 -0
- package/v2Containers/Zalo/constants.js +57 -0
- package/v2Containers/Zalo/index.js +391 -0
- package/v2Containers/Zalo/index.scss +76 -0
- package/v2Containers/Zalo/messages.js +74 -0
- package/v2Containers/Zalo/reducer.js +57 -0
- package/v2Containers/Zalo/saga.js +35 -0
- package/v2Containers/Zalo/selectors.js +14 -0
- package/v2Containers/Zalo/tests/actions.test.js +20 -0
- package/v2Containers/Zalo/tests/index.test.js +127 -0
- package/v2Containers/Zalo/tests/mockData.js +11470 -0
- package/v2Containers/Zalo/tests/reducer.test.js +85 -0
- package/v2Containers/Zalo/tests/saga.test.js +115 -0
- package/v2Containers/Zalo/tests/selectors.test.js +52 -0
- package/v2Containers/mockdata.js +817 -680
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { injectIntl } from "react-intl";
|
|
3
|
+
import { browserHistory } from "react-router";
|
|
4
|
+
import "@testing-library/jest-dom";
|
|
5
|
+
import { Provider } from "react-redux";
|
|
6
|
+
import configureStore from "../../../store";
|
|
7
|
+
import { Zalo } from "..";
|
|
8
|
+
import {
|
|
9
|
+
metaEntities,
|
|
10
|
+
zaloTemplateInfoData,
|
|
11
|
+
location,
|
|
12
|
+
getDefaultTags,
|
|
13
|
+
injectedTags,
|
|
14
|
+
template,
|
|
15
|
+
templateData,
|
|
16
|
+
} from "./mockData";
|
|
17
|
+
import {
|
|
18
|
+
render,
|
|
19
|
+
screen,
|
|
20
|
+
fireEvent,
|
|
21
|
+
} from "../../../utils/test-utils";
|
|
22
|
+
|
|
23
|
+
const mockActions = {
|
|
24
|
+
getTemplateInfoById: jest.fn(),
|
|
25
|
+
fetchSchemaForEntity: jest.fn(),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
let store;
|
|
29
|
+
beforeAll(() => {
|
|
30
|
+
store = configureStore({}, browserHistory);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const ComponentToRender = injectIntl(Zalo);
|
|
34
|
+
const renderComponent = (props) => render(
|
|
35
|
+
<Provider store={store}>
|
|
36
|
+
<ComponentToRender {...props} />
|
|
37
|
+
</Provider>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
describe("Test activity zalo container", () => {
|
|
42
|
+
it("test case for zalo template", async () => {
|
|
43
|
+
renderComponent({
|
|
44
|
+
actions: mockActions,
|
|
45
|
+
zaloTemplateInfoData,
|
|
46
|
+
metaEntities,
|
|
47
|
+
location,
|
|
48
|
+
getDefaultTags,
|
|
49
|
+
injectedTags,
|
|
50
|
+
template,
|
|
51
|
+
templateData,
|
|
52
|
+
});
|
|
53
|
+
const inputBox = await screen.findAllByPlaceholderText('Add labels or text or combination of both');
|
|
54
|
+
fireEvent.change(inputBox[0], { target: { value: "Hello, welcome" } });
|
|
55
|
+
inputBox[0].focus();
|
|
56
|
+
const previewButton = screen.getByTestId("preview-link-button");
|
|
57
|
+
previewButton.click();
|
|
58
|
+
expect(
|
|
59
|
+
screen.getByText("This template has been enabled")
|
|
60
|
+
).toBeInTheDocument();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("test case for text field curly braces error", async () => {
|
|
64
|
+
renderComponent({
|
|
65
|
+
actions: mockActions,
|
|
66
|
+
zaloTemplateInfoData,
|
|
67
|
+
metaEntities,
|
|
68
|
+
location,
|
|
69
|
+
getDefaultTags,
|
|
70
|
+
injectedTags,
|
|
71
|
+
template,
|
|
72
|
+
templateData,
|
|
73
|
+
});
|
|
74
|
+
const inputBox = await screen.findAllByPlaceholderText('Add labels or text or combination of both');
|
|
75
|
+
fireEvent.change(inputBox[0], { target: { value: "Hello, welcome {{" } });
|
|
76
|
+
inputBox[0].focus();
|
|
77
|
+
expect(
|
|
78
|
+
screen.getByText("Invalid label, please close all curly braces")
|
|
79
|
+
).toBeInTheDocument();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("test case for unsupported tag", async () => {
|
|
83
|
+
renderComponent({
|
|
84
|
+
actions: mockActions,
|
|
85
|
+
zaloTemplateInfoData,
|
|
86
|
+
metaEntities,
|
|
87
|
+
location,
|
|
88
|
+
getDefaultTags,
|
|
89
|
+
injectedTags,
|
|
90
|
+
template,
|
|
91
|
+
templateData,
|
|
92
|
+
});
|
|
93
|
+
const inputBox = await screen.findAllByPlaceholderText('Add labels or text or combination of both');
|
|
94
|
+
fireEvent.change(inputBox[0], {
|
|
95
|
+
target: { value: "Hello, welcome {{fsdaf}}" },
|
|
96
|
+
});
|
|
97
|
+
inputBox[0].focus();
|
|
98
|
+
expect(
|
|
99
|
+
screen.getByText(
|
|
100
|
+
"Unsupported tags: fsdaf. Please remove them from this message."
|
|
101
|
+
)
|
|
102
|
+
).toBeInTheDocument();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("test case for length check", async () => {
|
|
106
|
+
renderComponent({
|
|
107
|
+
actions: mockActions,
|
|
108
|
+
zaloTemplateInfoData,
|
|
109
|
+
metaEntities,
|
|
110
|
+
location,
|
|
111
|
+
getDefaultTags,
|
|
112
|
+
injectedTags,
|
|
113
|
+
template,
|
|
114
|
+
templateData,
|
|
115
|
+
});
|
|
116
|
+
const inputBox = await screen.findAllByPlaceholderText('Add labels or text or combination of both');
|
|
117
|
+
fireEvent.change(inputBox[0], {
|
|
118
|
+
target: {
|
|
119
|
+
value: "Hello, welcome user. Habata itara modoranai to ittta Mezashita no wa aoi aoi ano sora",
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
inputBox[0].focus();
|
|
123
|
+
expect(
|
|
124
|
+
screen.getByText("Character count for this variable should be in between 0 to 30")
|
|
125
|
+
).toBeInTheDocument();
|
|
126
|
+
});
|
|
127
|
+
});
|