@capillarytech/creatives-library 7.17.39-alpha.5 → 7.17.40-alpha.0

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.
Files changed (39) hide show
  1. package/components/CapTagList/index.js +1 -1
  2. package/components/CapTagList/messages.js +4 -0
  3. package/components/FormBuilder/index.js +2 -2
  4. package/components/FormBuilder/messages.js +8 -0
  5. package/containers/App/constants.js +26 -0
  6. package/containers/Assets/Gallery/index.js +1 -1
  7. package/containers/Assets/Gallery/messages.js +4 -0
  8. package/containers/Email/index.js +1 -1
  9. package/containers/Templates/index.js +1 -1
  10. package/containers/Templates/messages.js +4 -0
  11. package/index.js +2 -2
  12. package/package.json +1 -1
  13. package/services/api.js +6 -6
  14. package/utils/common.js +13 -2
  15. package/utils/tests/common.test.js +5 -5
  16. package/v2Components/CapTagList/index.js +1 -2
  17. package/v2Components/FormBuilder/index.js +1 -1
  18. package/v2Components/FormBuilder/messages.js +4 -0
  19. package/v2Containers/CreativesContainer/SlideBoxContent.js +6 -12
  20. package/v2Containers/CreativesContainer/SlideBoxHeader.js +3 -2
  21. package/v2Containers/CreativesContainer/index.js +7 -55
  22. package/v2Containers/CreativesContainer/messages.js +9 -1
  23. package/v2Containers/TagList/index.js +18 -5
  24. package/v2Containers/Templates/index.js +3 -17
  25. package/v2Containers/Templates/messages.js +0 -4
  26. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +129 -28
  27. package/v2Containers/TemplatesV2/tests/index.test.js +0 -1
  28. package/v2Containers/Zalo/constants.js +1 -0
  29. package/v2Containers/Zalo/index.js +185 -301
  30. package/v2Containers/Zalo/index.scss +4 -3
  31. package/v2Containers/Zalo/messages.js +5 -17
  32. package/v2Containers/Zalo/saga.js +4 -10
  33. package/v2Containers/Zalo/selectors.js +10 -8
  34. package/v2Containers/Zalo/tests/index.test.js +48 -67
  35. package/v2Containers/Zalo/tests/mockData.js +5045 -5056
  36. package/v2Containers/Zalo/tests/reducer.test.js +3 -3
  37. package/v2Containers/Zalo/tests/saga.test.js +2 -5
  38. package/v2Containers/Zalo/tests/selectors.test.js +52 -0
  39. package/v2Containers/Zalo/tests/selector.test.js +0 -28
@@ -10,7 +10,7 @@ import {
10
10
  SUCCESS,
11
11
  ERROR,
12
12
  } from "../constants";
13
- import { editData } from "./mockData";
13
+ import { zaloTemplateInfoData } 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 = editData.zaloTemplateInfoValue;
40
+ action.result = zaloTemplateInfoData.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 = editData.zaloTemplateInfoValue;
60
+ action.result = zaloTemplateInfoData.zaloTemplateInfoValue;
61
61
  state = state
62
62
  .set("zaloTemplateInfoStatus", SUCCESS)
63
63
  .set("zaloTemplatePreviewData", action.result)
@@ -12,7 +12,6 @@ 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();
16
15
  describe("zalo test saga", () => {
17
16
  it("handle success response from getTemplateInfoById", () => {
18
17
  expectSaga(getTemplateInfoById, {
@@ -21,7 +20,6 @@ describe("zalo saga", () => {
21
20
  username: "capillary_zns",
22
21
  oa_id: "kfhksda7326kjs",
23
22
  token: "tyfdusafhdsk783687342678",
24
- actionCallback
25
23
  },
26
24
  })
27
25
  .provide([
@@ -48,7 +46,6 @@ describe("zalo saga", () => {
48
46
  oa_id: "kfhksda7326kjs",
49
47
  token: "tyfdusafhdsk783687342678",
50
48
  preview: true,
51
- actionCallback
52
49
  },
53
50
  })
54
51
  .provide([
@@ -86,7 +83,7 @@ describe("zalo saga", () => {
86
83
  });
87
84
  it("handle failure response from getTemplateInfoById", () => {
88
85
  expectSaga(getTemplateInfoById, {
89
- payload: {actionCallback},
86
+ payload: {},
90
87
  })
91
88
  .provide([
92
89
  [
@@ -103,7 +100,7 @@ describe("zalo saga", () => {
103
100
  });
104
101
 
105
102
  it("handles error thrown", () => {
106
- testSaga(getTemplateInfoById, {payload: {actionCallback}}).next().throw(error).next().isDone();
103
+ testSaga(getTemplateInfoById, {}).next().throw(error).next().isDone();
107
104
  });
108
105
  });
109
106
 
@@ -0,0 +1,52 @@
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
+ });
@@ -1,28 +0,0 @@
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
- });