mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
* 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
23 lines
762 B
TypeScript
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();
|
|
});
|
|
});
|