Simpl-Resultat/src/services/feedbackService.test.ts
maximus 4f4ab87bea feat: feedback hub widget in Settings Logs card (#67)
Closes #67

Add opt-in Feedback Hub widget integrated into the Settings Logs card. Routes through a Rust command to bypass CORS and centralize privacy audit. First submission triggers a one-time consent dialog; three opt-in checkboxes (context, logs, identify with Maximus account) all unchecked by default. Wording and payload follow the cross-app conventions in la-compagnie-maximus/docs/feedback-hub-ops.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 14:36:26 +00:00

20 lines
836 B
TypeScript

import { describe, it, expect } from "vitest";
import { isFeedbackErrorCode } from "./feedbackService";
describe("isFeedbackErrorCode", () => {
it("recognizes the four stable error codes", () => {
expect(isFeedbackErrorCode("invalid")).toBe(true);
expect(isFeedbackErrorCode("rate_limit")).toBe(true);
expect(isFeedbackErrorCode("server_error")).toBe(true);
expect(isFeedbackErrorCode("network_error")).toBe(true);
});
it("rejects unknown strings and non-strings", () => {
expect(isFeedbackErrorCode("boom")).toBe(false);
expect(isFeedbackErrorCode("")).toBe(false);
expect(isFeedbackErrorCode(404)).toBe(false);
expect(isFeedbackErrorCode(null)).toBe(false);
expect(isFeedbackErrorCode(undefined)).toBe(false);
expect(isFeedbackErrorCode({ error: "rate_limit" })).toBe(false);
});
});