Files
hyperframes/packages/cli/src/utils/feedbackSource.test.ts
T
Miguel Ángel 0ca69472d9 feat(cli): feedback says whether a person or an agent wrote it, with the email an app attaches (#4984)
* feat(cli): feedback says whether a person or an agent wrote it, with the email an app attaches

* refactor(cli): split the .env loader so each part stays simple

* fix(cli): a broken .env loader fails loudly; only a missing .env is ignored
2026-10-04 05:07:49 +00:00

23 lines
762 B
TypeScript

import { describe, expect, it } from "vitest";
import { feedbackEmail, parseFeedbackSource } from "./feedbackSource.js";
describe("parseFeedbackSource", () => {
it.each([
[undefined, undefined],
["person", "person"],
[" agent ", "agent"],
["Person", null],
["", null],
])("%j reads as %j", (raw, expected) => {
expect(parseFeedbackSource(raw)).toBe(expected);
});
});
describe("feedbackEmail", () => {
it("reads only HYPERFRAMES_FEEDBACK_EMAIL, trimmed, and nothing when blank", () => {
expect(feedbackEmail({ HYPERFRAMES_FEEDBACK_EMAIL: " a@b.co " })).toBe("a@b.co");
expect(feedbackEmail({ HYPERFRAMES_FEEDBACK_EMAIL: " " })).toBeUndefined();
expect(feedbackEmail({ EMAIL: "a@b.co" })).toBeUndefined();
});
});