@capillarytech/creatives-library 8.0.26 → 8.0.27

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 (50) hide show
  1. package/containers/Cap/selectors.js +1 -2
  2. package/containers/Cap/tests/__snapshots__/index.test.js.snap +8 -0
  3. package/containers/Cap/tests/selectors.test.js +28 -0
  4. package/containers/LanguageProvider/tests/index.test.js +8 -30
  5. package/package.json +5 -8
  6. package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +5 -2
  7. package/tests/store.test.js +5 -4
  8. package/utils/ApiCaller.js +0 -12
  9. package/utils/test-utils.js +4 -8
  10. package/utils/tests/cdnTransformation.test.js +1 -1
  11. package/v2Components/CapDeviceContent/tests/index.test.js +5 -12
  12. package/v2Components/Ckeditor/tests/index.test.js +3 -15
  13. package/v2Components/FormBuilder/tests/index.test.js +3 -2
  14. package/v2Components/NavigationBar/tests/index.test.js +3 -2
  15. package/v2Components/NewCallTask/tests/index.test.js +3 -2
  16. package/v2Containers/Cap/index.js +0 -5
  17. package/v2Containers/Cap/tests/Cap.test.js +7 -16
  18. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +8 -0
  19. package/v2Containers/Cap/tests/selectors.test.js +26 -27
  20. package/v2Containers/CreativesContainer/index.js +1 -1
  21. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +3 -2
  22. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +9 -9
  23. package/v2Containers/Email/tests/sagas.test.js +27 -23
  24. package/v2Containers/InApp/tests/index.test.js +3 -11
  25. package/v2Containers/InApp/tests/sagas.test.js +10 -13
  26. package/v2Containers/LanguageProvider/tests/index.test.js +11 -19
  27. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +90 -287
  28. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +58 -116
  29. package/v2Containers/Line/Container/ImageCarousel/tests/content.test.js +3 -2
  30. package/v2Containers/Line/Container/ImageCarousel/tests/index.test.js +3 -2
  31. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +396 -254
  32. package/v2Containers/Line/Container/Wrapper/tests/index.test.js +3 -11
  33. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +215 -395
  34. package/v2Containers/Line/Container/tests/index.test.js +4 -3
  35. package/v2Containers/MobilePush/Edit/index.js +7 -8
  36. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +133186 -146971
  37. package/v2Containers/Rcs/tests/index.test.js +4 -12
  38. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +169 -31
  39. package/v2Containers/SmsTrai/Create/tests/index.test.js +10 -15
  40. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +1457 -817
  41. package/v2Containers/SmsTrai/Edit/tests/index.test.js +3 -14
  42. package/v2Containers/TagList/tests/TagList.test.js +3 -2
  43. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +20 -14
  44. package/v2Containers/TemplatesV2/index.js +55 -80
  45. package/v2Containers/TemplatesV2/tests/index.test.js +4 -3
  46. package/v2Containers/Viber/tests/index.test.js +3 -10
  47. package/v2Containers/Whatsapp/index.js +0 -1
  48. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +32562 -5611
  49. package/v2Containers/Whatsapp/tests/index.test.js +12 -31
  50. package/v2Containers/Zalo/tests/index.test.js +3 -11
@@ -26,12 +26,11 @@ const setInjectedTags = () => createSelector(
26
26
  const { tags } = metaEntities;
27
27
  const customTags = tags && (tags.custom || {});
28
28
  const extendedTags = tags && (tags.extended || {});
29
-
29
+
30
30
  return (injectedTags = _.merge({}, injectedTags, customTags, extendedTags));
31
31
  }
32
32
  );
33
33
 
34
- //Note required
35
34
  // const makeSelectLocationState = () => {
36
35
  // let prevRoutingState;
37
36
  // let prevRoutingStateJS;
@@ -179,6 +179,7 @@ exports[`<Cap /> should render its children 1`] = `
179
179
  "creatives.components.TemplatePreview.smsFormatType": "Message has unicode characters",
180
180
  "creatives.components.TemplatePreview.smsIcon": "Sms Icon",
181
181
  "creatives.components.TemplatePreview.unicodeIconTooltip": "This message has unicode characters. This may affect the cost per message.",
182
+ "creatives.components.TestPage.header": "Looks like youas are lost!",
182
183
  "creatives.components.Toastr.header": "This is the Toastr component !",
183
184
  "creatives.components.ToastrMessage.close": "close",
184
185
  "creatives.components.ToastrMessage.header": "This is the ToastrMessage component !",
@@ -863,6 +864,9 @@ exports[`<Cap /> should render its children 1`] = `
863
864
  "creatives.containers.Templates.wechatHeader": "WECHAT",
864
865
  "creatives.containers.Templates.yesText": "Yes",
865
866
  "creatives.containers.Templates.zipUploadFailed": "Failed to upload zip file",
867
+ "creatives.containers.Testv2.descriptionTestv2": "Description of Testv2",
868
+ "creatives.containers.Testv2.header": "This is Testv2 container !",
869
+ "creatives.containers.Testv2.testv2": "Testv2",
866
870
  "creatives.containers.View.descriptionView": "Description of View",
867
871
  "creatives.containers.View.header": "This is View container !",
868
872
  "creatives.containers.View.view": "View",
@@ -1869,6 +1873,10 @@ new message content.",
1869
1873
  "creatives.containersV2.TemplatesV2.viber": "Viber",
1870
1874
  "creatives.containersV2.TemplatesV2.wechat": "Wechat",
1871
1875
  "creatives.containersV2.TemplatesV2.whatsapp": "WhatsApp",
1876
+ "creatives.containersV2.TestPage.header": "Looks like youas are lost!",
1877
+ "creatives.containersV2.Testv2.descriptionTestv2": "Description of Testv2",
1878
+ "creatives.containersV2.Testv2.header": "This is Testv2 container !",
1879
+ "creatives.containersV2.Testv2.testv2": "Testv2",
1872
1880
  "creatives.containersV2.View.descriptionView": "Description of View",
1873
1881
  "creatives.containersV2.View.header": "This is View container !",
1874
1882
  "creatives.containersV2.View.view": "View",
@@ -0,0 +1,28 @@
1
+ import { fromJS } from 'immutable';
2
+
3
+ import { makeSelectLocationState } from 'containers/Cap/selectors';
4
+
5
+ describe('makeSelectLocationState', () => {
6
+ it('should select the route as a plain JS object', () => {
7
+ const route = fromJS({
8
+ locationBeforeTransitions: null,
9
+ });
10
+ const mockedState = fromJS({
11
+ route,
12
+ });
13
+ expect(makeSelectLocationState()(mockedState)).toEqual(route.toJS());
14
+ });
15
+
16
+ it('should return cached js routeState for same concurrent calls', () => {
17
+ const route = fromJS({
18
+ locationBeforeTransitions: null,
19
+ });
20
+ const mockedState = fromJS({
21
+ route,
22
+ });
23
+ const selectLocationState = makeSelectLocationState();
24
+
25
+ const firstRouteStateJS = selectLocationState(mockedState);
26
+ expect(selectLocationState(mockedState)).toBe(firstRouteStateJS);
27
+ });
28
+ });
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { shallow, mount } from 'enzyme';
3
3
  import { FormattedMessage, defineMessages } from 'react-intl';
4
4
  import { Provider } from 'react-redux';
5
- import history from '../../../utils/history';
5
+ import { createBrowserHistory } from 'history';
6
6
 
7
7
  import ConnectedLanguageProvider, { LanguageProvider } from '../index';
8
8
  import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
@@ -24,21 +24,10 @@ jest.mock('antd/es/locale-provider/ja_JP', () => 'jaJP');
24
24
  describe('<LanguageProvider />', () => {
25
25
  it('should render its children', () => {
26
26
  const children = (<h1>Test</h1>);
27
- const mockActions = {
28
- getLocizMessage: jest.fn(),
29
- };
30
-
31
- const language={
32
- locale: 'en',
33
- };
34
-
35
- const props = {
36
- messages : messages,
37
- language: language,
38
- actions: mockActions,
39
- };
40
27
  const renderedComponent = shallow(
41
- <LanguageProvider {...props}>
28
+ <LanguageProvider messages={messages} language={{
29
+ locale: 'en',
30
+ }}>
42
31
  {children}
43
32
  </LanguageProvider>
44
33
  );
@@ -48,27 +37,16 @@ describe('<LanguageProvider />', () => {
48
37
 
49
38
  describe('<ConnectedLanguageProvider />', () => {
50
39
  let store;
40
+ let browserHistory = createBrowserHistory();
51
41
 
52
42
  beforeAll(() => {
53
- store = configureStore({}, initialReducer, history);
43
+ store = configureStore({}, initialReducer, browserHistory);
54
44
  });
55
45
 
56
46
  it('should render the default language messages', () => {
57
- const mockActions = {
58
- getLocizMessage: jest.fn(),
59
- };
60
- const language = {
61
- locale: 'en',
62
- }
63
- const messages = {translationMessages}
64
- const props = {
65
- messages: messages,
66
- language: language,
67
- actions: mockActions,
68
- }
69
- const renderedComponent = shallow(
47
+ const renderedComponent = mount(
70
48
  <Provider store={store}>
71
- <ConnectedLanguageProvider {...props}>
49
+ <ConnectedLanguageProvider messages={translationMessages}>
72
50
  <FormattedMessage {...messages.someMessage} />
73
51
  </ConnectedLanguageProvider>
74
52
  </Provider>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.26",
4
+ "version": "8.0.27",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -12,23 +12,20 @@
12
12
  },
13
13
  "license": "LicenseRef-LICENSE",
14
14
  "dependencies": {
15
- "@babel/plugin-proposal-logical-assignment-operators": "^7.20.7",
16
15
  "@babel/polyfill": "7.4.3",
17
16
  "@bugsnag/js": "^7.2.1",
18
- "@bugsnag/plugin-react": "7.2.1",
17
+ "@bugsnag/plugin-react": "^7.2.1",
19
18
  "@capillarytech/cap-ui-utils": "3.0.4",
20
- "@capillarytech/vulcan-react-sdk": "^2.2.2",
19
+ "@capillarytech/vulcan-react-sdk": "^2.0.13",
21
20
  "@mailupinc/bee-plugin": "^1.2.0",
22
21
  "babel-cli": "^6.26.0",
23
22
  "chalk": "^2.4.2",
24
- "cheerio": "^1.0.0-rc.3",
25
23
  "connected-react-router": "4.5.0",
26
24
  "flow": "^0.2.3",
27
25
  "git": "^0.1.5",
28
26
  "history": "4.9.0",
29
27
  "html-to-text": "^8.2.1",
30
28
  "jest-date-mock": "^1.0.8",
31
- "jest-environment-jsdom": "27.5.1",
32
29
  "jquery": "^3.3.1",
33
30
  "load-script": "^1.0.0",
34
31
  "ml-matrix": "6.10.8",
@@ -39,7 +36,6 @@
39
36
  "pre-push": "^0.1.2",
40
37
  "react-datepicker": "1.8.0",
41
38
  "react-dropzone": "^11.3.4",
42
- "react-intl": "2.7.2",
43
39
  "react-phone-input-2": "^2.15.0",
44
40
  "react-router": "5.0.0",
45
41
  "react-router-dom": "5.0.0",
@@ -52,6 +48,7 @@
52
48
  "styled-components": "6.1.2",
53
49
  "uuid": "^10.0.0",
54
50
  "webpack-bugsnag-plugins": "^1.4.3",
55
- "whatwg-fetch": "3.0.0"
51
+ "whatwg-fetch": "3.0.0",
52
+ "react-intl": "2.7.2"
56
53
  }
57
54
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { BrowserRouter as Router } from 'react-router-dom';
3
3
  import { Provider } from 'react-redux';
4
- import history from '../../../utils/history';
4
+ import { createMemoryHistory } from 'history';
5
5
  import userEvent from '@testing-library/user-event';
6
6
  import { server } from './msw-handler';
7
7
  import {
@@ -33,7 +33,10 @@ jest.mock('@capillarytech/cap-ui-utils', () => ({
33
33
 
34
34
  jest.setTimeout(60000);
35
35
 
36
- const initializeCreatives = () => {
36
+ let history;
37
+
38
+ const initializeCreatives = () => {
39
+ history = createMemoryHistory();
37
40
  const store = configureStore(mockInitialState, initialReducer, history);
38
41
  history.push('creatives/ui/v2');
39
42
  render(
@@ -2,20 +2,21 @@
2
2
  * Test store addons
3
3
  */
4
4
 
5
- import history from '../utils/history';
5
+ import { createBrowserHistory } from 'history';
6
6
  import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
7
7
  import { initialReducer } from '../initialReducer';
8
8
 
9
9
  describe('configureStore', () => {
10
10
  let store;
11
+ let browserHistory = createBrowserHistory();
11
12
 
12
13
  beforeAll(() => {
13
- store = configureStore({}, initialReducer, history);
14
+ store = configureStore({}, initialReducer, browserHistory);
14
15
  });
15
16
 
16
- describe('initialReducer', () => {
17
+ describe('asyncReducers', () => {
17
18
  it('should contain an object for async reducers', () => {
18
- expect(typeof store.initialReducer).toBe('object');
19
+ expect(typeof store.asyncReducers).toBe('object');
19
20
  });
20
21
  });
21
22
 
@@ -38,18 +38,6 @@ export const clearFromLocalStorage = (key) => {
38
38
  }
39
39
  };
40
40
 
41
- export const getLocale = () => {
42
- try {
43
- const serializedState = localStorage.getItem('jlocale');
44
- if (serializedState === null) {
45
- return undefined;
46
- }
47
- return serializedState;
48
- } catch (err) {
49
- return undefined;
50
- }
51
- };
52
-
53
41
  function getRequestConfig(isFileUpload) {
54
42
  // const dataOrgId = (process.env.NODE_ENV === 'production') ? appConfig.production.data_org_id : appConfig.development.data_org_id;
55
43
  const config = requestConfig;
@@ -3,11 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { render as rtlRender } from '@testing-library/react';
4
4
  import { IntlProvider } from 'react-intl';
5
5
  import { Router, Route } from 'react-router-dom';
6
- import history from './history';
7
- import { Provider } from 'react-redux';
8
- import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
9
- import { initialReducer } from '../initialReducer';
10
- import initialState from '../initialState';
6
+ import { createMemoryHistory } from 'history';
11
7
 
12
8
  function Wrapper({ children }) {
13
9
  return <IntlProvider locale="en">{children}</IntlProvider>;
@@ -20,21 +16,21 @@ function render(ui, renderOptions = {}) {
20
16
  return rtlRender(ui, { wrapper: Wrapper, ...renderOptions });
21
17
  }
22
18
 
23
-
24
19
  function renderWithRouter(
25
20
  Component,
26
21
  props,
27
22
  { routePath = '/', historyPush = '/' } = {},
28
23
  renderOptions,
29
24
  ) {
25
+ const history = createMemoryHistory();
30
26
  history.push(historyPush);
31
27
 
32
28
  return {
33
29
  history,
34
30
  ...rtlRender(
35
- <Router history={history}>
31
+ <Router history={history}>
36
32
  <Route
37
- path={routePath}
33
+ path={routePath}
38
34
  render={(routeProps) => <Component {...props} {...routeProps} />}
39
35
  />
40
36
  </Router>,
@@ -6,7 +6,7 @@ import * as cdnTransformationHandler from './cdnTransformation.handler.mockdata'
6
6
 
7
7
  var bugsnagSpy;
8
8
  var localStorageMock;
9
- jest.setTimeout(180000);
9
+ jest.setTimeout(10000);
10
10
  beforeEach(() => {
11
11
  localStorageMock = (function () {
12
12
  var store = {
@@ -1,32 +1,25 @@
1
1
  import React from 'react';
2
2
  import { injectIntl } from 'react-intl';
3
- import history from '../../../utils/history';
3
+ import { createBrowserHistory } from 'history';
4
4
  import '@testing-library/jest-dom';
5
5
  import { Provider } from 'react-redux';
6
6
  import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
7
7
  import { initialReducer } from '../../../initialReducer';
8
8
  import CapDeviceContent from '../index';
9
- import { render, screen, fireEvent, renderWithRouter } from '../../../utils/test-utils';
9
+ import { render, screen, fireEvent } from '../../../utils/test-utils';
10
10
  import { deviceContentProps } from '../../../v2Containers/InApp/tests/mockData';
11
11
 
12
- jest.mock('../../../v2Containers/TagList/index.js', () => ({
13
- __esModule: true,
14
- default: (props) => (
15
- <div className="tag-mock" {...props}>
16
- TagList
17
- </div>
18
- ),
19
- }));
20
12
 
21
13
  let store;
14
+ const browserHistory = createBrowserHistory();
22
15
  beforeAll(() => {
23
- store = configureStore({}, initialReducer, history);
16
+ store = configureStore({}, initialReducer, browserHistory);
24
17
  });
25
18
 
26
19
  const ComponentToRender = injectIntl(CapDeviceContent);
27
20
  const renderComponent = (props) =>
28
21
  render(
29
- <Provider store={store}>
22
+ <Provider store={store}>
30
23
  <ComponentToRender {...props} />
31
24
  </Provider>,
32
25
  );
@@ -3,25 +3,13 @@ import { Provider } from "react-redux";
3
3
  import { injectIntl } from "react-intl";
4
4
  import "@testing-library/jest-dom";
5
5
  import { render, getByText, screen } from "../../../utils/test-utils";
6
- import { configureStore } from '@capillarytech/vulcan-react-sdk/utils'
7
- import { initialReducer } from '../../../initialReducer';
6
+ import configureStore from '../../../store';
8
7
  import Ckeditor from "../index";
9
- import history from 'utils/history';
10
-
11
-
12
-
13
- jest.mock('../../../v2Containers/TagList/index.js', () => ({
14
- __esModule: true,
15
- default: (props) => (
16
- <div className="tag-mock" {...props}>
17
- TagList
18
- </div>
19
- ),
20
- }));
8
+ import { browserHistory } from 'react-router';
21
9
 
22
10
  let store;
23
11
  beforeAll(() => {
24
- store = configureStore({},initialReducer, history);
12
+ store = configureStore({}, browserHistory);
25
13
  });
26
14
  const initializeComponent = () => {
27
15
  const Component = injectIntl(Ckeditor);
@@ -4,7 +4,7 @@ import '@testing-library/jest-dom';
4
4
  import FormBuilder from '../index';
5
5
  import { Provider } from 'react-redux';
6
6
  import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
7
- import history from "../../../utils/history";
7
+ import { createBrowserHistory } from 'history';
8
8
  import { initialReducer } from "../../../initialReducer";
9
9
  import {
10
10
  render,
@@ -17,7 +17,8 @@ import { mockData } from './mockData';
17
17
 
18
18
  const ComponentToRender = injectIntl(FormBuilder);
19
19
  const renderComponent = props => {
20
- const store = configureStore({}, initialReducer, history);
20
+ let browserHistory = createBrowserHistory();
21
+ const store = configureStore({}, initialReducer, browserHistory);
21
22
  return render(
22
23
  <Provider store={store}>
23
24
  <ComponentToRender {...props} />
@@ -9,13 +9,14 @@ import { NavigationBar } from '../index';
9
9
  import * as mockdata from './mockData';
10
10
  import { Provider } from 'react-redux';
11
11
  import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
12
- import history from '../../../utils/history';
12
+ import { createBrowserHistory } from 'history';
13
13
  import { initialReducer } from '../../../initialReducer';
14
14
  const { userData } = mockdata;
15
15
 
16
16
  let store;
17
+ let browserHistory = createBrowserHistory();
17
18
  beforeAll(() => {
18
- store = configureStore({}, initialReducer, history);
19
+ store = configureStore({}, initialReducer, browserHistory);
19
20
  });
20
21
  const ComponentToRender = injectIntl(NavigationBar);
21
22
  const renderComponent = (props) => {
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { injectIntl } from 'react-intl';
3
3
  import '@testing-library/jest-dom';
4
4
  import { Provider } from 'react-redux';
5
- import history from "../../../utils/history";
5
+ import { createBrowserHistory } from 'history';
6
6
  import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
7
7
  import { initialReducer } from "../../../initialReducer";
8
8
  import NewCallTask from '../index';
@@ -14,7 +14,8 @@ import { Router } from "express";
14
14
  const ComponentToRender = injectIntl(NewCallTask);
15
15
 
16
16
  const renderComponent = (props) => {
17
- const store = configureStore({}, initialReducer, history);
17
+ let browserHistory = createBrowserHistory();
18
+ const store = configureStore({}, initialReducer, browserHistory);
18
19
  return render(
19
20
  <Router>
20
21
  <Provider store={store}>
@@ -52,8 +52,6 @@ import { v2RcsSagas } from '../Rcs/sagas';
52
52
  import { v2InAppSagas } from '../InApp/sagas';
53
53
  import { v2ViberSagas } from '../Viber/sagas';
54
54
  import { v2FacebookSagas } from '../Facebook/sagas';
55
- import { Router } from 'react-router-dom';
56
- import history from '../../utils/history';
57
55
 
58
56
  const gtm = window.dataLayer || [];
59
57
  const {
@@ -543,8 +541,6 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
543
541
  handleLeftNavBarExpanded={this.handleLeftNavBarExpanded}
544
542
  leftNavbarExpandedProp={this.state.leftNavbarExpanded}
545
543
  />) : ''}
546
-
547
- <Router history={history}>
548
544
  <MainWrapper isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled} className="main">
549
545
 
550
546
  <ContentWrapper
@@ -565,7 +561,6 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
565
561
  </Switch>
566
562
  </ContentWrapper>
567
563
  </MainWrapper>
568
- </Router>
569
564
  </div>
570
565
  {(toastMessages && toastMessages.length > 0) &&
571
566
  toastMessages.map((message) => {
@@ -1,19 +1,19 @@
1
1
  // This test in written using React Testing library. Written during setting up this library to make sure tests are working.
2
2
  import React from 'react';
3
- import { IntlProvider, injectIntl } from 'react-intl';
3
+ import { injectIntl } from 'react-intl';
4
4
  import '@testing-library/jest-dom';
5
5
  import { screen } from '@testing-library/react';
6
6
  import { Provider } from 'react-redux';
7
7
  import cloneDeep from 'lodash/cloneDeep';
8
8
  import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
9
- import history from '../../../utils/history';
9
+ import { createBrowserHistory } from 'history';
10
10
  import { initialReducer } from '../../../initialReducer';
11
11
  import { render } from '../../../utils/test-utils';
12
12
  import { Cap } from '../index';
13
13
  import mockData from '../../mockdata';
14
14
  const {
15
15
  demoVideoAndLinkJSONData,
16
- // history,
16
+ history,
17
17
  location,
18
18
  match,
19
19
  Global,
@@ -22,25 +22,16 @@ const {
22
22
  const ComponentToRender = injectIntl(Cap);
23
23
 
24
24
  const renderComponent = (props) => {
25
- const store = configureStore({}, initialReducer, history);
26
- return render(
25
+ let browserHistory = createBrowserHistory();
26
+ const store = configureStore({}, initialReducer, browserHistory);
27
+ render(
27
28
  <Provider store={store}>
28
- <ComponentToRender {...props} />
29
-
29
+ <ComponentToRender {...props} />
30
30
  </Provider>,
31
31
  );
32
32
  };
33
33
 
34
34
  jest.setTimeout(15000);
35
-
36
- jest.mock('../../TagList/index.js', () => ({
37
- __esModule: true,
38
- default: (props) => (
39
- <div className="tag-mock" {...props}>
40
- TagList
41
- </div>
42
- ),
43
- }));
44
35
  jest.mock('@capillarytech/cap-ui-utils', () => ({
45
36
  ...jest.requireActual('@capillarytech/cap-ui-utils'),
46
37
  GA: {
@@ -214,6 +214,7 @@ exports[`<Cap /> should render correct component 1`] = `
214
214
  "creatives.components.TemplatePreview.smsFormatType": "Message has unicode characters",
215
215
  "creatives.components.TemplatePreview.smsIcon": "Sms Icon",
216
216
  "creatives.components.TemplatePreview.unicodeIconTooltip": "This message has unicode characters. This may affect the cost per message.",
217
+ "creatives.components.TestPage.header": "Looks like youas are lost!",
217
218
  "creatives.components.Toastr.header": "This is the Toastr component !",
218
219
  "creatives.components.ToastrMessage.close": "close",
219
220
  "creatives.components.ToastrMessage.header": "This is the ToastrMessage component !",
@@ -898,6 +899,9 @@ exports[`<Cap /> should render correct component 1`] = `
898
899
  "creatives.containers.Templates.wechatHeader": "WECHAT",
899
900
  "creatives.containers.Templates.yesText": "Yes",
900
901
  "creatives.containers.Templates.zipUploadFailed": "Failed to upload zip file",
902
+ "creatives.containers.Testv2.descriptionTestv2": "Description of Testv2",
903
+ "creatives.containers.Testv2.header": "This is Testv2 container !",
904
+ "creatives.containers.Testv2.testv2": "Testv2",
901
905
  "creatives.containers.View.descriptionView": "Description of View",
902
906
  "creatives.containers.View.header": "This is View container !",
903
907
  "creatives.containers.View.view": "View",
@@ -1904,6 +1908,10 @@ new message content.",
1904
1908
  "creatives.containersV2.TemplatesV2.viber": "Viber",
1905
1909
  "creatives.containersV2.TemplatesV2.wechat": "Wechat",
1906
1910
  "creatives.containersV2.TemplatesV2.whatsapp": "WhatsApp",
1911
+ "creatives.containersV2.TestPage.header": "Looks like youas are lost!",
1912
+ "creatives.containersV2.Testv2.descriptionTestv2": "Description of Testv2",
1913
+ "creatives.containersV2.Testv2.header": "This is Testv2 container !",
1914
+ "creatives.containersV2.Testv2.testv2": "Testv2",
1907
1915
  "creatives.containersV2.View.descriptionView": "Description of View",
1908
1916
  "creatives.containersV2.View.header": "This is View container !",
1909
1917
  "creatives.containersV2.View.view": "View",
@@ -1,6 +1,6 @@
1
1
  import { fromJS } from 'immutable';
2
2
 
3
- import { makeSelectDemoVideoAndLink } from 'v2Containers/Cap/selectors';
3
+ import { makeSelectLocationState, makeSelectDemoVideoAndLink } from 'v2Containers/Cap/selectors';
4
4
 
5
5
  describe('CapSelectors', () => {
6
6
  const mockState = fromJS({
@@ -11,32 +11,30 @@ describe('CapSelectors', () => {
11
11
  },
12
12
  });
13
13
 
14
-
15
- //not need now :Temp
16
- // describe('makeSelectLocationState', () => {
17
- // it('should select the route as a plain JS object', () => {
18
- // const route = fromJS({
19
- // locationBeforeTransitions: null,
20
- // });
21
- // const mockedState = fromJS({
22
- // route,
23
- // });
24
- // expect(makeSelectLocationState()(mockedState)).toEqual(route.toJS());
25
- // });
26
-
27
- // it('should return cached js routeState for same concurrent calls', () => {
28
- // const route = fromJS({
29
- // locationBeforeTransitions: null,
30
- // });
31
- // const mockedState = fromJS({
32
- // route,
33
- // });
34
- // const selectLocationState = makeSelectLocationState();
35
-
36
- // const firstRouteStateJS = selectLocationState(mockedState);
37
- // expect(selectLocationState(mockedState)).toBe(firstRouteStateJS);
38
- // });
39
- // });
14
+ describe('makeSelectLocationState', () => {
15
+ it('should select the route as a plain JS object', () => {
16
+ const route = fromJS({
17
+ locationBeforeTransitions: null,
18
+ });
19
+ const mockedState = fromJS({
20
+ route,
21
+ });
22
+ expect(makeSelectLocationState()(mockedState)).toEqual(route.toJS());
23
+ });
24
+
25
+ it('should return cached js routeState for same concurrent calls', () => {
26
+ const route = fromJS({
27
+ locationBeforeTransitions: null,
28
+ });
29
+ const mockedState = fromJS({
30
+ route,
31
+ });
32
+ const selectLocationState = makeSelectLocationState();
33
+
34
+ const firstRouteStateJS = selectLocationState(mockedState);
35
+ expect(selectLocationState(mockedState)).toBe(firstRouteStateJS);
36
+ });
37
+ });
40
38
 
41
39
  describe('makeSelectDemoVideoAndLink selector', () => {
42
40
  it('should return the correct substate', () => {
@@ -51,3 +49,4 @@ describe('CapSelectors', () => {
51
49
  });
52
50
  });
53
51
  });
52
+
@@ -448,7 +448,7 @@ export class Creatives extends React.Component {
448
448
  } = {},
449
449
  } = templateData;
450
450
  const mediaParams = {};
451
- const { url = '', previewUrl = '', docParams = {}, footer = '', headerVarMapped = {}, headerTemplate = ''} = whatsappMedia;
451
+ const { url = '', previewUrl = '', docParams = {}, footer = '', headerVarMapped = {}, headerTemplate = ''} = whatsappMedia || {};
452
452
  switch (mediaType) {
453
453
  case (WHATSAPP_MEDIA_TYPES.IMAGE):
454
454
  mediaParams.imageUrl = url;
@@ -3,7 +3,7 @@ import { injectIntl } from 'react-intl';
3
3
  import '@testing-library/jest-dom';
4
4
  import { Provider } from 'react-redux';
5
5
  import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
6
- import history from "../../../utils/history";
6
+ import { createBrowserHistory } from 'history';
7
7
  import { initialReducer } from "../../../initialReducer";
8
8
  import {
9
9
  render,
@@ -13,7 +13,8 @@ import SlideBoxFooter from "../SlideBoxFooter";
13
13
 
14
14
  const ComponentToRender = injectIntl(SlideBoxFooter);
15
15
  const renderComponent = props => {
16
- const store = configureStore({}, initialReducer, history);
16
+ let browserHistory = createBrowserHistory();
17
+ const store = configureStore({}, initialReducer, browserHistory);
17
18
  return render(
18
19
  <Provider store={store}>
19
20
  <ComponentToRender {...props} />