fix: preserve safe motion and consent failures
This commit is contained in:
1 parent
a4e5e5c048
commit
bea235d6fd
4 files changed
+61
-14
No files matched your search
@@ -240,7 +240,7 @@ describe("GoogleAnalytics consent", () => {
|
||||
|
||||
expect(
|
||||
screen.getByRole("alert", {
|
||||
name: "Falha ao salvar a revogação",
|
||||
name: "Falha ao salvar o consentimento",
|
||||
}),
|
||||
).toHaveTextContent(
|
||||
"Não foi possível salvar a revogação. Tente novamente para concluir.",
|
||||
@@ -250,4 +250,30 @@ describe("GoogleAnalytics consent", () => {
|
||||
screen.getByRole("button", { name: "Revogar analytics" }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
it("reports when refusal cannot be persisted", async () => {
|
||||
const user = userEvent.setup();
|
||||
jest.spyOn(Storage.prototype, "setItem").mockImplementation(() => {
|
||||
throw new Error("storage blocked");
|
||||
});
|
||||
render(<GoogleAnalytics />);
|
||||
|
||||
await user.click(
|
||||
await screen.findByRole("button", { name: "Recusar analytics" }),
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole("alert", {
|
||||
name: "Falha ao salvar o consentimento",
|
||||
}),
|
||||
).toHaveTextContent(
|
||||
"Não foi possível salvar sua recusa. Tente novamente para concluir.",
|
||||
);
|
||||
expect(
|
||||
screen.getByRole("button", { name: "Recusar analytics" }),
|
||||
).toBeVisible();
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "Preferências de analytics" }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user