1- import React from 'react' ;
21import { Provider } from 'react-redux' ;
32
43import { getConfig , mergeConfig } from '@edx/frontend-platform' ;
54import { sendPageEvent , sendTrackEvent } from '@edx/frontend-platform/analytics' ;
6- import { configure , injectIntl , IntlProvider } from '@edx/frontend-platform/i18n' ;
5+ import { configure , IntlProvider } from '@edx/frontend-platform/i18n' ;
76import { fireEvent , render , screen } from '@testing-library/react' ;
87import { MemoryRouter } from 'react-router-dom' ;
98import configureStore from 'redux-mock-store' ;
@@ -23,7 +22,6 @@ jest.mock('@edx/frontend-platform/analytics', () => ({
2322jest . mock ( '@edx/frontend-platform/auth' ) ;
2423
2524const mockStore = configureStore ( ) ;
26- const IntlLogistration = injectIntl ( Logistration ) ;
2725
2826describe ( 'Logistration' , ( ) => {
2927 let store = { } ;
@@ -95,7 +93,7 @@ describe('Logistration', () => {
9593 } ) ;
9694
9795 it ( 'should do nothing when user clicks on the same tab (login/register) again' , ( ) => {
98- const { container } = render ( reduxWrapper ( < IntlLogistration /> ) ) ;
96+ const { container } = render ( reduxWrapper ( < Logistration /> ) ) ;
9997 // While staying on the registration form, clicking the register tab again
10098 fireEvent . click ( container . querySelector ( 'a[data-rb-event-key="/register"]' ) ) ;
10199
@@ -107,14 +105,14 @@ describe('Logistration', () => {
107105 ALLOW_PUBLIC_ACCOUNT_CREATION : true ,
108106 } ) ;
109107
110- const { container } = render ( reduxWrapper ( < IntlLogistration /> ) ) ;
108+ const { container } = render ( reduxWrapper ( < Logistration /> ) ) ;
111109
112110 expect ( container . querySelector ( 'RegistrationPage' ) ) . toBeDefined ( ) ;
113111 } ) ;
114112
115113 it ( 'should render login page' , ( ) => {
116114 const props = { selectedPage : LOGIN_PAGE } ;
117- const { container } = render ( reduxWrapper ( < IntlLogistration { ...props } /> ) ) ;
115+ const { container } = render ( reduxWrapper ( < Logistration { ...props } /> ) ) ;
118116
119117 expect ( container . querySelector ( 'LoginPage' ) ) . toBeDefined ( ) ;
120118 } ) ;
@@ -125,15 +123,15 @@ describe('Logistration', () => {
125123 } ) ;
126124
127125 let props = { selectedPage : LOGIN_PAGE } ;
128- const { rerender } = render ( reduxWrapper ( < IntlLogistration { ...props } /> ) ) ;
126+ const { rerender } = render ( reduxWrapper ( < Logistration { ...props } /> ) ) ;
129127
130128 // verifying sign in heading
131129 expect ( screen . getByRole ( 'heading' , { level : 3 } ) . textContent ) . toEqual ( 'Sign in' ) ;
132130
133131 // register page is still accessible when SHOW_REGISTRATION_LINKS is false
134132 // but it needs to be accessed directly
135133 props = { selectedPage : REGISTER_PAGE } ;
136- rerender ( reduxWrapper ( < IntlLogistration { ...props } /> ) ) ;
134+ rerender ( reduxWrapper ( < Logistration { ...props } /> ) ) ;
137135
138136 // verifying register heading
139137 expect ( screen . getByRole ( 'heading' , { level : 3 } ) . textContent ) . toEqual ( 'Register' ) ;
@@ -160,7 +158,7 @@ describe('Logistration', () => {
160158 } ) ;
161159
162160 const props = { selectedPage : LOGIN_PAGE } ;
163- const { container } = render ( reduxWrapper ( < IntlLogistration { ...props } /> ) ) ;
161+ const { container } = render ( reduxWrapper ( < Logistration { ...props } /> ) ) ;
164162
165163 // verifying sign in heading for institution login false
166164 expect ( screen . getByRole ( 'heading' , { level : 3 } ) . textContent ) . toEqual ( 'Sign in' ) ;
@@ -190,7 +188,7 @@ describe('Logistration', () => {
190188 } ) ;
191189
192190 const props = { selectedPage : LOGIN_PAGE } ;
193- render ( reduxWrapper ( < IntlLogistration { ...props } /> ) ) ;
191+ render ( reduxWrapper ( < Logistration { ...props } /> ) ) ;
194192 expect ( screen . getByText ( 'Institution/campus credentials' ) ) . toBeDefined ( ) ;
195193
196194 // on clicking "Institution/campus credentials" button, it should display institution login page
@@ -221,7 +219,7 @@ describe('Logistration', () => {
221219 } ) ;
222220
223221 const props = { selectedPage : LOGIN_PAGE } ;
224- render ( reduxWrapper ( < IntlLogistration { ...props } /> ) ) ;
222+ render ( reduxWrapper ( < Logistration { ...props } /> ) ) ;
225223 fireEvent . click ( screen . getByText ( 'Institution/campus credentials' ) ) ;
226224
227225 expect ( sendTrackEvent ) . toHaveBeenCalledWith ( 'edx.bi.institution_login_form.toggled' , { category : 'user-engagement' } ) ;
@@ -253,7 +251,7 @@ describe('Logistration', () => {
253251 delete window . location ;
254252 window . location = { hostname : getConfig ( ) . SITE_NAME , href : getConfig ( ) . BASE_URL } ;
255253
256- render ( reduxWrapper ( < IntlLogistration /> ) ) ;
254+ render ( reduxWrapper ( < Logistration /> ) ) ;
257255 fireEvent . click ( screen . getByText ( 'Institution/campus credentials' ) ) ;
258256 expect ( screen . getByText ( 'Test University' ) ) . toBeDefined ( ) ;
259257
@@ -264,22 +262,22 @@ describe('Logistration', () => {
264262
265263 it ( 'should fire action to backup registration form on tab click' , ( ) => {
266264 store . dispatch = jest . fn ( store . dispatch ) ;
267- const { container } = render ( reduxWrapper ( < IntlLogistration /> ) ) ;
265+ const { container } = render ( reduxWrapper ( < Logistration /> ) ) ;
268266 fireEvent . click ( container . querySelector ( 'a[data-rb-event-key="/login"]' ) ) ;
269267 expect ( store . dispatch ) . toHaveBeenCalledWith ( backupRegistrationForm ( ) ) ;
270268 } ) ;
271269
272270 it ( 'should fire action to backup login form on tab click' , ( ) => {
273271 store . dispatch = jest . fn ( store . dispatch ) ;
274272 const props = { selectedPage : LOGIN_PAGE } ;
275- const { container } = render ( reduxWrapper ( < IntlLogistration { ...props } /> ) ) ;
273+ const { container } = render ( reduxWrapper ( < Logistration { ...props } /> ) ) ;
276274 fireEvent . click ( container . querySelector ( 'a[data-rb-event-key="/register"]' ) ) ;
277275 expect ( store . dispatch ) . toHaveBeenCalledWith ( backupLoginForm ( ) ) ;
278276 } ) ;
279277
280278 it ( 'should clear tpa context errorMessage tab click' , ( ) => {
281279 store . dispatch = jest . fn ( store . dispatch ) ;
282- const { container } = render ( reduxWrapper ( < IntlLogistration /> ) ) ;
280+ const { container } = render ( reduxWrapper ( < Logistration /> ) ) ;
283281 fireEvent . click ( container . querySelector ( 'a[data-rb-event-key="/login"]' ) ) ;
284282 expect ( store . dispatch ) . toHaveBeenCalledWith ( clearThirdPartyAuthContextErrorMessage ( ) ) ;
285283 } ) ;
0 commit comments