serviceAuthority.test.ts 777 B

1234567891011121314151617181920212223242526272829
  1. import { describe, expect, it } from "vitest";
  2. import {
  3. parseServiceAuthorityMode,
  4. SERVICE_AUTHORITY_MODE_ENV,
  5. } from "../src/serviceAuthority.js";
  6. describe("service authority mode", () => {
  7. it("parses desktop attached remote mode from env", () => {
  8. expect(
  9. parseServiceAuthorityMode({
  10. [SERVICE_AUTHORITY_MODE_ENV]: "desktop-attached-remote",
  11. }),
  12. ).toEqual({
  13. mode: "desktop-attached-remote",
  14. invalidRawValue: undefined,
  15. });
  16. });
  17. it("falls back to legacy authority when env value is invalid", () => {
  18. expect(
  19. parseServiceAuthorityMode({
  20. [SERVICE_AUTHORITY_MODE_ENV]: "remote-but-not-valid",
  21. }),
  22. ).toEqual({
  23. mode: undefined,
  24. invalidRawValue: "remote-but-not-valid",
  25. });
  26. });
  27. });