File tree 1 file changed +25
-0
lines changed
site/src/components/AuthAndFrame 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { fireEvent , screen } from "@testing-library/react"
2
+ import { renderWithAuth } from "testHelpers/renderHelpers"
3
+ import { AccountPage } from "pages/UserSettingsPage/AccountPage/AccountPage"
4
+ import i18next from "i18next"
5
+
6
+ const { t } = i18next
7
+
8
+ describe ( "AuthAndFrame" , ( ) => {
9
+ it ( "sets localStorage key-value when dismissed" , async ( ) => {
10
+ const localStorageMock = {
11
+ ...global . localStorage ,
12
+ getItem : jest . fn ( ) ,
13
+ }
14
+ global . localStorage = localStorageMock
15
+
16
+ // rendering a random page that is wrapped in AuthAndFrame
17
+ return renderWithAuth ( < AccountPage /> )
18
+ fireEvent . click (
19
+ screen . getByRole ( "button" , {
20
+ name : t ( "ctas.dismissCta" , { ns : "common" } ) ,
21
+ } ) ,
22
+ )
23
+ expect ( localStorageMock . getItem ) . toHaveBeenCalledWith ( "dismissedVersion" )
24
+ } )
25
+ } )
You can’t perform that action at this time.
0 commit comments