Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

1.3 KB
Raw Blame
import fs from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";

// Literal paths, not a helper: `path.join(__dirname, someVariable)` is dynamic
// filesystem access, and Turbopack responds to that by tracing the whole project,
// which fails the release gate as a build warning. When a route body moves to a
// colocated handler.ts, point the literal at that file.
const AUTHORIZATION_SERVER = fs.readFileSync(
  path.join(__dirname, "../../app/.well-known/oauth-authorization-server/handler.ts"),
  "utf8",
);
const PROTECTED_RESOURCE = fs.readFileSync(
  path.join(__dirname, "../../app/.well-known/oauth-protected-resource/handler.ts"),
  "utf8",
);

const EXPECTED_SCOPES = '["read", "write", "exec", "offline_access"]';

describe("OAuth discovery contract", () => {
  it("keeps discovery behind the MCP enable gate", () => {
    for (const source of [AUTHORIZATION_SERVER, PROTECTED_RESOURCE]) {
      expect(source).toContain("if (!mcpEnabled()) return new Response(\"Not Found\", { status: 404 });");
    }
  });

  it("advertises the complete consent vocabulary including exec and offline access", () => {
    for (const source of [AUTHORIZATION_SERVER, PROTECTED_RESOURCE]) {
      expect(source).toContain(`scopes_supported: ${EXPECTED_SCOPES}`);
    }
  });
});