Skip to content

Commit 56faac2

Browse files
refactor: after review
1 parent d60cb53 commit 56faac2

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

src/containers/LearnerDashboardHeader/BrandLogo.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import { useContext } from 'react';
2-
31
import { useIntl } from '@edx/frontend-platform/i18n';
42

5-
import { AppContext } from '@edx/frontend-platform/react';
63
import { reduxHooks } from 'hooks';
74

85
import { getConfig } from '@edx/frontend-platform';
@@ -11,10 +8,9 @@ import messages from './messages';
118
export const BrandLogo = () => {
129
const { formatMessage } = useIntl();
1310
const dashboard = reduxHooks.useEnterpriseDashboardData();
14-
const { config } = useContext(AppContext);
1511

1612
return (
17-
<a href={dashboard?.url || config.LMS_BASE_URL} className="mx-auto">
13+
<a href={dashboard?.url || getConfig().LMS_BASE_URL} className="mx-auto">
1814
<img
1915
className="logo py-3"
2016
src={getConfig().LOGO_URL}
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { shallow } from '@edx/react-unit-test-utils';
2-
2+
import { getConfig } from '@edx/frontend-platform';
33
import { reduxHooks } from 'hooks';
4+
45
import BrandLogo from './BrandLogo';
56

67
jest.mock('hooks', () => ({
@@ -9,14 +10,6 @@ jest.mock('hooks', () => ({
910
},
1011
}));
1112

12-
jest.mock('@edx/frontend-platform/react', () => ({
13-
AppContext: {
14-
config: {
15-
LMS_BASE_URL: '/',
16-
},
17-
},
18-
}));
19-
2013
describe('BrandLogo', () => {
2114
test('dashboard defined', () => {
2215
reduxHooks.useEnterpriseDashboardData.mockReturnValueOnce({
@@ -31,6 +24,6 @@ describe('BrandLogo', () => {
3124
reduxHooks.useEnterpriseDashboardData.mockReturnValueOnce(null);
3225
const wrapper = shallow(<BrandLogo />);
3326
expect(wrapper.snapshot).toMatchSnapshot();
34-
expect(wrapper.instance.findByType('a')[0].props.href).toEqual('/');
27+
expect(wrapper.instance.findByType('a')[0].props.href).toEqual(getConfig().LMS_BASE_URL);
3528
});
3629
});

src/containers/LearnerDashboardHeader/__snapshots__/BrandLogo.test.jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports[`BrandLogo dashboard defined 1`] = `
1616
exports[`BrandLogo dashboard undefined 1`] = `
1717
<a
1818
className="mx-auto"
19-
href="/"
19+
href="http://localhost:18000"
2020
>
2121
<img
2222
alt="edX, Inc. Dashboard"

0 commit comments

Comments
 (0)