File tree Expand file tree Collapse file tree 3 files changed +5
-16
lines changed
Expand file tree Collapse file tree 3 files changed +5
-16
lines changed Original file line number Diff line number Diff line change 1- import { useContext } from 'react' ;
2-
31import { useIntl } from '@edx/frontend-platform/i18n' ;
42
5- import { AppContext } from '@edx/frontend-platform/react' ;
63import { reduxHooks } from 'hooks' ;
74
85import { getConfig } from '@edx/frontend-platform' ;
@@ -11,10 +8,9 @@ import messages from './messages';
118export 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 }
Original file line number Diff line number Diff line change 11import { shallow } from '@edx/react-unit-test-utils' ;
2-
2+ import { getConfig } from '@edx/frontend-platform' ;
33import { reduxHooks } from 'hooks' ;
4+
45import BrandLogo from './BrandLogo' ;
56
67jest . 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-
2013describe ( '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} ) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ exports[`BrandLogo dashboard defined 1`] = `
1616exports [` 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"
You can’t perform that action at this time.
0 commit comments