@@ -3,7 +3,6 @@ import { createMemoryHistory } from 'history';
33import userEvent from '@testing-library/user-event' ;
44import { createEvent , fireEvent , waitFor } from '@testing-library/react' ;
55
6- import * as MzAUtils from 'amo/utils/fxa' ;
76import { setViewContext } from 'amo/actions/viewContext' ;
87import { createApiError } from 'amo/api/index' ;
98import { extractId } from 'amo/pages/UserProfileEdit' ;
@@ -54,7 +53,6 @@ describe(__filename, () => {
5453 const defaultUserId = fakeAuthors [ 0 ] . id ;
5554 let history ;
5655 let store ;
57- let isMzaBrandingMock ;
5856
5957 const savedLocation = window . location ;
6058
@@ -65,14 +63,10 @@ describe(__filename, () => {
6563 assign : jest . fn ( ) ,
6664 } ) ;
6765 window . scroll = jest . fn ( ) ;
68- isMzaBrandingMock = jest
69- . spyOn ( MzAUtils , 'isMzaBranding' )
70- . mockReturnValue ( true ) ;
7166 } ) ;
7267
7368 afterEach ( ( ) => {
7469 window . location = savedLocation ;
75- isMzaBrandingMock . mockRestore ( ) ;
7670 } ) ;
7771
7872 function defaultUserProps ( props = { } ) {
@@ -1413,99 +1407,4 @@ describe(__filename, () => {
14131407 ) . not . toHaveClass ( 'UserProfileEditPicture-file--has-focus' ) ;
14141408 } ) ;
14151409 } ) ;
1416-
1417- describe ( 'Tests for accounts branding' , ( ) => {
1418- it ( 'renders the Mozilla accounts Branding' , ( ) => {
1419- isMzaBrandingMock . mockReturnValue ( true ) ;
1420- renderForCurrentUser ( ) ;
1421-
1422- expect (
1423- screen . getByRole ( 'link' , {
1424- name : 'Manage Mozilla accounts…' ,
1425- } ) ,
1426- ) . toBeInTheDocument ( ) ;
1427- expect (
1428- screen . getByTextAcrossTags (
1429- 'You can change your email address on Mozilla accounts. Need help?' ,
1430- ) ,
1431- ) . toBeInTheDocument ( ) ;
1432-
1433- const bannerElement = screen . getByClassName ( 'UserProfileEdit-fxa-notice' ) ;
1434- expect ( bannerElement ) . toBeInTheDocument ( ) ;
1435- expect ( bannerElement ) . toHaveTextContent (
1436- 'Firefox Accounts was renamed to Mozilla accounts on Nov 1' ,
1437- ) ;
1438- } ) ;
1439-
1440- it ( 'renders the Firefox Accounts Branding' , ( ) => {
1441- isMzaBrandingMock . mockReturnValue ( false ) ;
1442- renderForCurrentUser ( ) ;
1443-
1444- expect (
1445- screen . getByRole ( 'link' , {
1446- name : 'Manage Firefox Accounts…' ,
1447- } ) ,
1448- ) . toBeInTheDocument ( ) ;
1449- expect (
1450- screen . getByTextAcrossTags (
1451- 'You can change your email address on Firefox Accounts. Need help?' ,
1452- ) ,
1453- ) . toBeInTheDocument ( ) ;
1454-
1455- const bannerElement = screen . getByClassName ( 'UserProfileEdit-fxa-notice' ) ;
1456- expect ( bannerElement ) . toBeInTheDocument ( ) ;
1457- expect ( bannerElement ) . toHaveTextContent (
1458- 'Firefox Accounts will be renamed to Mozilla accounts on Nov 1' ,
1459- ) ;
1460- } ) ;
1461- } ) ;
1462-
1463- describe ( 'isMzaBranding datetime switch' , ( ) => {
1464- let dateMock ;
1465-
1466- beforeEach ( ( ) => {
1467- isMzaBrandingMock . mockRestore ( ) ;
1468- } ) ;
1469-
1470- afterEach ( ( ) => {
1471- dateMock ?. mockRestore ( ) ;
1472- } ) ;
1473-
1474- it ( 'returns false if the date is earlier than MZA_LAUNCH_DATETIME' , ( ) => {
1475- const before = new Date ( ) ;
1476- before . setTime ( MzAUtils . MZA_LAUNCH_DATETIME . getTime ( ) - 1000 ) ;
1477- dateMock = jest . spyOn ( global , 'Date' ) . mockImplementation ( ( ) => before ) ;
1478- expect ( MzAUtils . isMzaBranding ( ) ) . toBe ( false ) ;
1479- } ) ;
1480-
1481- it ( 'returns true if the date is earlier than MZA_LAUNCH_DATETIME' , ( ) => {
1482- const after = new Date ( ) ;
1483- after . setTime ( MzAUtils . MZA_LAUNCH_DATETIME . getTime ( ) + 1000 ) ;
1484- dateMock = jest . spyOn ( global , 'Date' ) . mockImplementation ( ( ) => after ) ;
1485- expect ( MzAUtils . isMzaBranding ( ) ) . toBe ( true ) ;
1486- } ) ;
1487- } ) ;
1488-
1489- describe ( 'fxa banner tests' , ( ) => {
1490- it ( 'renders the banner on the page' , ( ) => {
1491- renderForCurrentUser ( ) ;
1492-
1493- const bannerElement = screen . getByClassName ( 'UserProfileEdit-fxa-notice' ) ;
1494- expect ( bannerElement ) . toBeInTheDocument ( ) ;
1495-
1496- expect ( bannerElement ) . toHaveTextContent (
1497- 'Firefox Accounts was renamed to Mozilla accounts on Nov 1' ,
1498- ) ;
1499- expect ( bannerElement ) . toHaveTextContent (
1500- 'You will still sign in with the same username and password, and there are no other changes to the products that you use.' ,
1501- ) ;
1502-
1503- const infoLink = screen . getByClassName ( 'Notice-button' ) ;
1504- expect ( infoLink ) . toBeInTheDocument ( ) ;
1505- expect ( infoLink ) . toHaveAttribute (
1506- 'href' ,
1507- 'https://support.mozilla.org/kb/firefox-accounts-renamed-mozilla-accounts' ,
1508- ) ;
1509- } ) ;
1510- } ) ;
15111410} ) ;
0 commit comments