account.test.ts 992 B

1234567891011121314151617181920212223242526
  1. import { describe, expect, test } from "bun:test"
  2. import stripAnsi from "strip-ansi"
  3. import { formatAccountLabel, formatOrgLine } from "../../src/cli/cmd/account"
  4. describe("console account display", () => {
  5. test("includes the account url in account labels", () => {
  6. expect(stripAnsi(formatAccountLabel({ email: "[email protected]", url: "https://one.example.com" }, false))).toBe(
  7. "[email protected] https://one.example.com",
  8. )
  9. })
  10. test("includes the active marker in account labels", () => {
  11. expect(stripAnsi(formatAccountLabel({ email: "[email protected]", url: "https://one.example.com" }, true))).toBe(
  12. "[email protected] https://one.example.com (active)",
  13. )
  14. })
  15. test("includes the account url in org rows", () => {
  16. expect(
  17. stripAnsi(
  18. formatOrgLine({ email: "[email protected]", url: "https://one.example.com" }, { id: "org-1", name: "One" }, true),
  19. ),
  20. ).toBe(" ● One [email protected] https://one.example.com org-1")
  21. })
  22. })