@@ -16,13 +16,24 @@ import { Account, AppContext } from '../../../models';
1616import { SettingsContext } from '../../../models/contexts/SettingsContext' ;
1717import firefox from '../../../lib/channels/firefox' ;
1818import { PLACEHOLDER_IMAGE_URL } from '../../../pages/mocks' ;
19+ import { JwtTokenCache , MfaOtpRequestCache } from '../../../lib/cache' ;
1920
2021jest . mock ( '../../../models/AlertBarInfo' ) ;
2122jest . mock ( 'fxa-settings/src/lib/metrics' , ( ) => ( {
2223 logViewEvent : jest . fn ( ) ,
2324 settingsViewName : 'quuz' ,
2425} ) ) ;
2526
27+ jest . mock ( '../../../lib/cache' , ( ) => ( {
28+ ...jest . requireActual ( '../../../lib/cache' ) ,
29+ JwtTokenCache : {
30+ clearTokens : jest . fn ( ) ,
31+ } ,
32+ MfaOtpRequestCache : {
33+ clear : jest . fn ( ) ,
34+ } ,
35+ } ) ) ;
36+
2637const account = {
2738 avatar : {
2839 id : 'abc1234' ,
@@ -38,6 +49,10 @@ const account = {
3849describe ( 'DropDownAvatarMenu' , ( ) => {
3950 const dropDownId = 'drop-down-avatar-menu' ;
4051
52+ beforeEach ( ( ) => {
53+ jest . resetAllMocks ( ) ;
54+ } ) ;
55+
4156 it ( 'renders and toggles as expected with default values' , ( ) => {
4257 const account = {
4358 avatar : { url : null , id : null } ,
@@ -142,6 +157,12 @@ describe('DropDownAvatarMenu', () => {
142157 expect ( window . location . assign ) . toHaveBeenCalledWith (
143158 window . location . origin
144159 ) ;
160+ expect ( JwtTokenCache . clearTokens ) . toHaveBeenCalledWith (
161+ mockSession ( ) . token
162+ ) ;
163+ expect ( MfaOtpRequestCache . clear ) . toHaveBeenCalledWith (
164+ mockSession ( ) . token
165+ ) ;
145166 } ) ;
146167
147168 it ( 'displays an error in the AlertBar' , async ( ) => {
0 commit comments