import { expect, test } from "bun:test";
import { emailInCsv } from "./super-admin";

test("emailInCsv matches case-insensitively, trims, ignores blanks", () => {
  const csv = "Alice@Example.com, bob@x.io ,";
  expect(emailInCsv("alice@example.com", csv)).toBe(true);
  expect(emailInCsv("  BOB@X.IO ", csv)).toBe(true);
  expect(emailInCsv("carol@x.io", csv)).toBe(false);
});

test("emailInCsv is false for empty email or empty list", () => {
  expect(emailInCsv("a@b.com", "")).toBe(false);
  expect(emailInCsv(null, "a@b.com")).toBe(false);
  expect(emailInCsv(undefined, "a@b.com")).toBe(false);
});
