@capillarytech/creatives-library 7.17.40-alpha.0 → 7.17.41
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/components/CapTagList/index.js +1 -1
- package/components/CapTagList/messages.js +0 -4
- package/components/FormBuilder/index.js +2 -2
- package/components/FormBuilder/messages.js +0 -8
- package/containers/App/constants.js +0 -26
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Assets/Gallery/messages.js +0 -4
- package/containers/Email/index.js +1 -1
- package/containers/Templates/index.js +1 -1
- package/containers/Templates/messages.js +0 -4
- package/index.js +2 -2
- package/package.json +1 -1
- package/services/api.js +6 -6
- package/utils/common.js +6 -13
- package/utils/tests/common.test.js +5 -5
- package/v2Components/CapTagList/index.js +2 -1
- package/v2Components/FormBuilder/index.js +1 -1
- package/v2Components/FormBuilder/messages.js +0 -4
- package/v2Components/TemplatePreview/_templatePreview.scss +40 -0
- package/v2Components/TemplatePreview/index.js +34 -0
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +47 -0
- package/v2Components/TemplatePreview/tests/index.test.js +9 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +12 -6
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -3
- package/v2Containers/CreativesContainer/index.js +57 -7
- package/v2Containers/CreativesContainer/messages.js +1 -9
- package/v2Containers/TagList/index.js +5 -18
- package/v2Containers/Templates/index.js +19 -4
- package/v2Containers/Templates/messages.js +4 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +28 -129
- package/v2Containers/TemplatesV2/tests/index.test.js +1 -0
- package/v2Containers/Zalo/constants.js +0 -1
- package/v2Containers/Zalo/index.js +280 -189
- package/v2Containers/Zalo/index.scss +3 -4
- package/v2Containers/Zalo/messages.js +17 -5
- package/v2Containers/Zalo/saga.js +10 -4
- package/v2Containers/Zalo/selectors.js +8 -10
- package/v2Containers/Zalo/tests/index.test.js +67 -48
- package/v2Containers/Zalo/tests/mockData.js +5056 -5045
- package/v2Containers/Zalo/tests/reducer.test.js +3 -3
- package/v2Containers/Zalo/tests/saga.test.js +5 -2
- package/v2Containers/Zalo/tests/selector.test.js +28 -0
- package/v2Containers/Zalo/tests/selectors.test.js +0 -52
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
SUCCESS,
|
|
11
11
|
ERROR,
|
|
12
12
|
} from "../constants";
|
|
13
|
-
import {
|
|
13
|
+
import { editData } from "./mockData";
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
describe("zalo reducer", () => {
|
|
@@ -37,7 +37,7 @@ describe("zalo reducer", () => {
|
|
|
37
37
|
});
|
|
38
38
|
it("should handle ZALO_TEMPLATE_INFO_SUCCESS action", () => {
|
|
39
39
|
action.type = ZALO_TEMPLATE_INFO_SUCCESS;
|
|
40
|
-
action.result =
|
|
40
|
+
action.result = editData.zaloTemplateInfoValue;
|
|
41
41
|
state = state
|
|
42
42
|
.set("zaloTemplateInfoStatus", SUCCESS)
|
|
43
43
|
.set("zaloTemplateInfoValue", action.result)
|
|
@@ -57,7 +57,7 @@ describe("zalo reducer", () => {
|
|
|
57
57
|
|
|
58
58
|
it("should handle ZALO_TEMPLATE_PREVIEW_INFO action", () => {
|
|
59
59
|
action.type = ZALO_TEMPLATE_PREVIEW_INFO;
|
|
60
|
-
action.result =
|
|
60
|
+
action.result = editData.zaloTemplateInfoValue;
|
|
61
61
|
state = state
|
|
62
62
|
.set("zaloTemplateInfoStatus", SUCCESS)
|
|
63
63
|
.set("zaloTemplatePreviewData", action.result)
|
|
@@ -12,6 +12,7 @@ import * as Api from "../../../services/api";
|
|
|
12
12
|
|
|
13
13
|
describe("zalo saga", () => {
|
|
14
14
|
const error = new Error("error");
|
|
15
|
+
const actionCallback = jest.fn();
|
|
15
16
|
describe("zalo test saga", () => {
|
|
16
17
|
it("handle success response from getTemplateInfoById", () => {
|
|
17
18
|
expectSaga(getTemplateInfoById, {
|
|
@@ -20,6 +21,7 @@ describe("zalo saga", () => {
|
|
|
20
21
|
username: "capillary_zns",
|
|
21
22
|
oa_id: "kfhksda7326kjs",
|
|
22
23
|
token: "tyfdusafhdsk783687342678",
|
|
24
|
+
actionCallback
|
|
23
25
|
},
|
|
24
26
|
})
|
|
25
27
|
.provide([
|
|
@@ -46,6 +48,7 @@ describe("zalo saga", () => {
|
|
|
46
48
|
oa_id: "kfhksda7326kjs",
|
|
47
49
|
token: "tyfdusafhdsk783687342678",
|
|
48
50
|
preview: true,
|
|
51
|
+
actionCallback
|
|
49
52
|
},
|
|
50
53
|
})
|
|
51
54
|
.provide([
|
|
@@ -83,7 +86,7 @@ describe("zalo saga", () => {
|
|
|
83
86
|
});
|
|
84
87
|
it("handle failure response from getTemplateInfoById", () => {
|
|
85
88
|
expectSaga(getTemplateInfoById, {
|
|
86
|
-
payload: {},
|
|
89
|
+
payload: {actionCallback},
|
|
87
90
|
})
|
|
88
91
|
.provide([
|
|
89
92
|
[
|
|
@@ -100,7 +103,7 @@ describe("zalo saga", () => {
|
|
|
100
103
|
});
|
|
101
104
|
|
|
102
105
|
it("handles error thrown", () => {
|
|
103
|
-
testSaga(getTemplateInfoById, {}).next().throw(error).next().isDone();
|
|
106
|
+
testSaga(getTemplateInfoById, {payload: {actionCallback}}).next().throw(error).next().isDone();
|
|
104
107
|
});
|
|
105
108
|
});
|
|
106
109
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { fromJS } from "immutable";
|
|
2
|
+
import { makeSelectZalo, makeSelectAccount } from "../selectors";
|
|
3
|
+
|
|
4
|
+
describe("makeSelectZalo", () => {
|
|
5
|
+
it("returns the expected object with default values when substate is empty", () => {
|
|
6
|
+
// Arrange
|
|
7
|
+
const state = fromJS({ zalo: {} });
|
|
8
|
+
const expected = {}
|
|
9
|
+
const selector = makeSelectZalo();
|
|
10
|
+
|
|
11
|
+
// Act
|
|
12
|
+
const result = selector(state);
|
|
13
|
+
// Assert
|
|
14
|
+
expect(result).toEqual(expected);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("returns the expected object with default values when substate is empty for makeSelectAccount", () => {
|
|
18
|
+
// Arrange
|
|
19
|
+
const state = fromJS({ templates: {} });
|
|
20
|
+
const expected = {}
|
|
21
|
+
const selector = makeSelectAccount();
|
|
22
|
+
|
|
23
|
+
// Act
|
|
24
|
+
const result = selector(state);
|
|
25
|
+
// Assert
|
|
26
|
+
expect(result).toEqual(expected);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { fromJS } from "immutable";
|
|
2
|
-
import { makeSelectZalo, selectZaloDomain } from "../selectors";
|
|
3
|
-
import { zaloTemplateInfoData } from "./mockData";
|
|
4
|
-
|
|
5
|
-
describe("makeSelectZalo", () => {
|
|
6
|
-
it("returns the expected object with default values when substate is empty", () => {
|
|
7
|
-
// Arrange
|
|
8
|
-
const state = fromJS({ zalo: {} });
|
|
9
|
-
const expected = {
|
|
10
|
-
zaloTemplateInfoStatus: undefined,
|
|
11
|
-
zaloTemplateInfoValue: undefined,
|
|
12
|
-
zaloTemplateInfoError: undefined,
|
|
13
|
-
zaloTemplatePreviewData: undefined,
|
|
14
|
-
};
|
|
15
|
-
const selector = makeSelectZalo();
|
|
16
|
-
|
|
17
|
-
// Act
|
|
18
|
-
const result = selector(state);
|
|
19
|
-
|
|
20
|
-
// Assert
|
|
21
|
-
expect(result).toEqual(expected);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("returns the expected object when substate has values", () => {
|
|
25
|
-
// Arrange
|
|
26
|
-
const state = fromJS({
|
|
27
|
-
zalo: zaloTemplateInfoData,
|
|
28
|
-
});
|
|
29
|
-
const expected = {
|
|
30
|
-
zaloTemplateInfoStatus: "success",
|
|
31
|
-
zaloTemplateInfoValue: fromJS(zaloTemplateInfoData.zaloTemplateInfoValue),
|
|
32
|
-
zaloTemplateInfoError: null,
|
|
33
|
-
zaloTemplatePreviewData: undefined,
|
|
34
|
-
};
|
|
35
|
-
const selector = makeSelectZalo();
|
|
36
|
-
|
|
37
|
-
// Act
|
|
38
|
-
const result = selector(state);
|
|
39
|
-
|
|
40
|
-
// Assert
|
|
41
|
-
expect(result).toEqual(expected);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("returns the expected object with default values when substate is empty", () => {
|
|
45
|
-
// Arrange
|
|
46
|
-
const state = fromJS({ zalo: {} });
|
|
47
|
-
const expected = fromJS({});
|
|
48
|
-
const result = selectZaloDomain(state);
|
|
49
|
-
// Assert
|
|
50
|
-
expect(result).toEqual(expected);
|
|
51
|
-
});
|
|
52
|
-
});
|