/** * RULE (MAIL ALL ON PHONE, coordinator, 24 Nov 2026: "the switch on for the owner account only first"): an account's * own switch, thrown with the admin token alone. On, every sync answer says `features: ["mail_all"]`, which a Comms * phone keeps beside its cursor and keeps all mail by from its next launch; off, no answer says it. All invented. */import { describe, expect, it } from"vitest";import { ADMIN, http, personalObject } from"./personal.ts";describe("the mail-all switch", () => { it("is the admin's alone, and every sync answer says it while it is on", async () => {const slug = "mail-all-switch";const { credential } = await personalObject(slug);const phone = { authorization: `Bearer ${credential}` };const sync = async () => (await http<{ features?: string[] }>(slug, "GET", "/v1/sync?since=0", undefined, phone)).body.features; expect(await sync()).toBeUndefined(); expect((await http(slug, "POST", "/v1/admin/mail-all", { on: true }, phone)).status).toBe(403); expect((await http(slug, "POST", "/v1/admin/mail-all", { on: "yes" }, ADMIN)).status).toBe(400); expect((await http(slug, "POST", "/v1/admin/mail-all", { on: true }, ADMIN)).body).toEqual({ on: true }); expect((await http(slug, "GET", "/v1/admin/mail-all", undefined, ADMIN)).body).toEqual({ on: true }); expect(await sync()).toEqual(["mail_all"]); expect((await http(slug, "POST", "/v1/admin/mail-all", { on: false }, ADMIN)).body).toEqual({ on: false }); expect(await sync()).toBeUndefined(); });});