@capillarytech/creatives-library 7.17.82-alpha.1 → 7.17.82

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.
@@ -38,25 +38,4 @@ describe('Test whatsapp actions', () => {
38
38
  actions.createWhatsappTemplate(payload, undefined, undefined),
39
39
  ).toStrictEqual(expected);
40
40
  });
41
-
42
- it("test getMetaTags", () => {
43
- const payload = {
44
- previewUrl: 'https://capillarytech.com',
45
- callBack: undefined,
46
- };
47
- const expected = {
48
- type: types.URL_META_TAGS_REQUEST,
49
- previewUrl: 'https://capillarytech.com',
50
- callBack: undefined,
51
- };
52
- expect(actions.getMetaTags(payload)).toStrictEqual(expected);
53
- });
54
-
55
- it("test resetMetaTags", () => {
56
- const expected = {
57
- type: types.URL_META_TAGS_RESET,
58
- };
59
- expect(actions.resetMetaTags()).toStrictEqual(expected);
60
- });
61
41
  });
62
-
@@ -23,8 +23,6 @@ describe('Creatives Whatsapp test1/>', () => {
23
23
  const handleClose = jest.fn();
24
24
  const onCreateComplete = jest.fn();
25
25
  const formatMessage = jest.fn();
26
- const getMetaTags = jest.fn();
27
- const resetMetaTags = jest.fn();
28
26
  const location = mockData.location;
29
27
  const params = {
30
28
  id: mockData.editData1.templateDetails._id,
@@ -44,8 +42,6 @@ describe('Creatives Whatsapp test1/>', () => {
44
42
  clearCreateResponse,
45
43
  getTemplateDetails,
46
44
  resetEditTemplate,
47
- getMetaTags,
48
- resetMetaTags,
49
45
  }}
50
46
  globalActions={{ fetchSchemaForEntity }}
51
47
  onCreateComplete={onCreateComplete}
@@ -272,8 +268,6 @@ describe('Creatives Whatsapp test2/>', () => {
272
268
  const handleClose = jest.fn();
273
269
  const onCreateComplete = jest.fn();
274
270
  const formatMessage = jest.fn();
275
- const getMetaTags = jest.fn();
276
- const resetMetaTags = jest.fn();
277
271
  const location = mockData.location;
278
272
  const params = {
279
273
  id: mockData.editData1.templateDetails._id,
@@ -290,8 +284,6 @@ describe('Creatives Whatsapp test2/>', () => {
290
284
  clearCreateResponse,
291
285
  getTemplateDetails,
292
286
  resetEditTemplate,
293
- getMetaTags,
294
- resetMetaTags,
295
287
  }}
296
288
  globalActions={{ fetchSchemaForEntity }}
297
289
  onCreateComplete={onCreateComplete}
@@ -245,10 +245,4 @@ export const mockData = {
245
245
  },
246
246
  search: '',
247
247
  },
248
- metaTagsMock: {
249
- image: 'https://capillarytech.com/assest/capillary.png',
250
- title: 'Capillary',
251
- description: 'sample',
252
- url: "https://capillarytech.com",
253
- },
254
248
  };
@@ -1,67 +0,0 @@
1
- import { fromJS } from "immutable";
2
- import whatsappReducer from "../reducer";
3
- import {
4
- URL_META_TAGS_REQUEST,
5
- URL_META_TAGS_SUCCESS,
6
- URL_META_TAGS_FAILURE,
7
- URL_META_TAGS_RESET,
8
- } from "../constants";
9
- import { mockData } from "./mockData";
10
-
11
- describe("whatsapp reducer", () => {
12
- let state;
13
- const action = {};
14
- beforeEach(() => {
15
- state = fromJS({
16
- getMetaTagsRequest: false,
17
- metaTagsDetails: {},
18
- getMetaTagsError: '',
19
- });
20
- });
21
-
22
- it("Reducer : URL_META_TAGS_REQUEST", () => {
23
- action.type = URL_META_TAGS_REQUEST;
24
- state = state
25
- .set("getMetaTagsRequest", true)
26
- .set("metaTagsDetails", {});
27
- const expectedResult = state;
28
- expect(whatsappReducer(state, action)).toEqual(
29
- expectedResult
30
- );
31
- });
32
-
33
- it("Reducer : URL_META_TAGS_SUCCESS", () => {
34
- action.type = URL_META_TAGS_SUCCESS;
35
- action.data = mockData.metaTagsMock;
36
- state = state
37
- .set("getMetaTagsRequest", false)
38
- .set("metaTagsDetails", mockData.metaTagsMock);
39
- const expectedResult = state;
40
- expect(whatsappReducer(state, action)).toEqual(
41
- expectedResult
42
- );
43
- });
44
-
45
- it("Reducer : URL_META_TAGS_FAILURE", () => {
46
- action.type = URL_META_TAGS_FAILURE;
47
- action.error = 'error';
48
- state = state
49
- .set("getMetaTagsRequest", false)
50
- .set("metaTagsDetails", {})
51
- .set("getMetaTagsError", 'error');
52
- const expectedResult = state;
53
- expect(whatsappReducer(state, action)).toEqual(
54
- expectedResult
55
- );
56
- });
57
-
58
- it("Reducer : URL_META_TAGS_RESET", () => {
59
- action.type = URL_META_TAGS_RESET;
60
- state = state
61
- .set("metaTagsDetails", {});
62
- const expectedResult = state;
63
- expect(whatsappReducer(state, action)).toEqual(
64
- expectedResult
65
- );
66
- });
67
- });
@@ -1,90 +0,0 @@
1
- import { expectSaga, testSaga } from "redux-saga-test-plan";
2
- import * as matchers from "redux-saga-test-plan/matchers";
3
- import { takeLatest } from "redux-saga/effects";
4
- import { getMetaTagsDetails, watchGetMetaTagsDetails } from "../sagas";
5
- import {
6
- URL_META_TAGS_REQUEST,
7
- URL_META_TAGS_SUCCESS,
8
- URL_META_TAGS_FAILURE,
9
- } from "../constants";
10
- import * as Api from "../../../services/api";
11
-
12
- describe("Whatsapp saga", () => {
13
- const error = new Error("error");
14
- const callBack = jest.fn();
15
- describe("whatsapp test saga", () => {
16
- it("handle success response from getMetaTagsDetails", () => {
17
- expectSaga(getMetaTagsDetails, {
18
- previewUrl: "https://capillarytech.com",
19
- callBack,
20
- }).provide([
21
- [
22
- matchers.call.fn(Api.getMetaTags),
23
- {
24
- success: true,
25
- result: [],
26
- },
27
- ],
28
- ])
29
- .put({
30
- type: URL_META_TAGS_SUCCESS,
31
- result: {},
32
- })
33
- .run();
34
- });
35
-
36
- it("handle success false response from getMetaTagsDetails", () => {
37
- expectSaga(getMetaTagsDetails, {
38
- previewUrl: "https://capillarytech.com",
39
- callBack,
40
- }).provide([
41
- [
42
- matchers.call.fn(Api.getMetaTags),
43
- {
44
- success: false,
45
- result: [],
46
- message: 'error',
47
- },
48
- ],
49
- ])
50
- .put({
51
- type: URL_META_TAGS_FAILURE,
52
- error: 'error',
53
- })
54
- .run();
55
- });
56
-
57
- it("handle success false response from getMetaTagsDetails when callback not present", () => {
58
- expectSaga(getMetaTagsDetails, {
59
- previewUrl: "https://capillarytech.com",
60
- }).provide([
61
- [
62
- matchers.call.fn(Api.getMetaTags),
63
- {
64
- success: false,
65
- result: [],
66
- message: 'error',
67
- },
68
- ],
69
- ])
70
- .put({
71
- type: URL_META_TAGS_FAILURE,
72
- error: 'error',
73
- })
74
- .run();
75
- });
76
-
77
- it("handles error thrown", () => {
78
- testSaga(getMetaTagsDetails, { callBack }).next().throw(error).next().isDone();
79
- });
80
- });
81
-
82
- describe("watchGetMetaTagsDetails saga", () => {
83
- const generator = watchGetMetaTagsDetails();
84
- it("should call watchers functions", async () => {
85
- expect(generator.next().value).toEqual(
86
- takeLatest(URL_META_TAGS_REQUEST, getMetaTagsDetails)
87
- );
88
- });
89
- });
90
- });