Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

701 B
Raw Blame
import { describe, expect, it } from "vite-plus/test";
import { parseInviteEmails } from "./invite-emails";

describe("parseInviteEmails", () => {
  it("ignores blank fields and dedupes case-insensitively", () => {
    expect(parseInviteEmails([" [email protected] ", "", "[email protected]"])).toEqual(
      { ok: true, emails: ["[email protected]"] },
    );
  });

  it("reports the positions of malformed addresses", () => {
    expect(parseInviteEmails(["[email protected]", "", "nope"])).toEqual({
      ok: false,
      invalidIndexes: [2],
    });
  });

  it("returns nothing to send when every field is blank", () => {
    expect(parseInviteEmails(["", "  "])).toEqual({ ok: true, emails: [] });
  });
});