Unverified Commit 701e3ff6 authored by Sudheer's avatar Sudheer Committed by GitHub
Browse files

MM-26885 Fix for client4 import (#5896)

* MM-26885 Fix for client4 import

* Fix an import override
parent 6907ac48
......@@ -3,7 +3,7 @@
import $ from 'jquery';
import {rudderAnalytics, client4} from 'mattermost-redux/client';
import {rudderAnalytics, Client4} from 'mattermost-redux/client';
import PropTypes from 'prop-types';
import React from 'react';
import FastClick from 'fastclick';
......@@ -164,7 +164,7 @@ export default class Root extends React.PureComponent {
const rudderUrl = Constants.DIAGNOSTICS_RUDDER_DATAPLANE_URL;
if (rudderKey != null && rudderKey !== '' && !rudderKey.startsWith('placeholder') && rudderUrl != null && rudderUrl !== '' && !rudderUrl.startsWith('placeholder') && this.props.diagnosticsEnabled) {
client4.enableRudderEvents();
Client4.enableRudderEvents();
rudderAnalytics.load(rudderKey, rudderUrl);
rudderAnalytics.identify(diagnosticId, {}, {
......
......@@ -4,7 +4,7 @@
import React from 'react';
import {shallow} from 'enzyme';
import {client4} from 'mattermost-redux/client';
import {Client4} from 'mattermost-redux/client';
import Root from 'components/root/root';
import * as GlobalActions from 'actions/global_actions.jsx';
......@@ -34,8 +34,9 @@ jest.mock('mattermost-redux/client', () => {
return {
...original,
client4: {
...original.client4,
Client4: {
...original.Client4,
setUrl: jest.fn(),
enableRudderEvents: jest.fn(),
},
};
......@@ -186,7 +187,7 @@ describe('components/Root', () => {
test('should not call enableRudderEvents on call of onConfigLoaded if url and key for rudder is not set', () => {
const wrapper = shallow(<Root {...baseProps}/>);
wrapper.instance().onConfigLoaded();
expect(client4.enableRudderEvents).not.toHaveBeenCalled();
expect(Client4.enableRudderEvents).not.toHaveBeenCalled();
});
test('should call for enableRudderEvents on call of onConfigLoaded if url and key for rudder is set', () => {
......@@ -195,6 +196,6 @@ describe('components/Root', () => {
const wrapper = shallow(<Root {...baseProps}/>);
wrapper.instance().onConfigLoaded();
expect(client4.enableRudderEvents).toHaveBeenCalled();
expect(Client4.enableRudderEvents).toHaveBeenCalled();
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment