Skip to content

fix: Store dismissedBanner key in localStorage #5388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
wote test
  • Loading branch information
Kira-Pilot committed Dec 12, 2022
commit c4e5057acc9b439a7c25bbda80cfdb895f27ec47
25 changes: 25 additions & 0 deletions site/src/components/AuthAndFrame/AuthAndFrame.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { fireEvent, screen } from "@testing-library/react"
import { renderWithAuth } from "testHelpers/renderHelpers"
import { AccountPage } from "pages/UserSettingsPage/AccountPage/AccountPage"
import i18next from "i18next"

const { t } = i18next

describe("AuthAndFrame", () => {
it("sets localStorage key-value when dismissed", async () => {
const localStorageMock = {
...global.localStorage,
getItem: jest.fn(),
}
global.localStorage = localStorageMock

// rendering a random page that is wrapped in AuthAndFrame
return renderWithAuth(<AccountPage />)
fireEvent.click(
screen.getByRole("button", {
name: t("ctas.dismissCta", { ns: "common" }),
}),
)
expect(localStorageMock.getItem).toHaveBeenCalledWith("dismissedVersion")
})
})