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.

992 B
Raw Blame
import { describe, expect, it } from "vitest";
import { GET } from "./route";

describe("GET /api/sw", () => {
  it("serves service worker as a public asset with 200 OK", async () => {
    const res = GET();
    expect(res.status).toBe(200);
  });

  it("sets required caching and service worker headers", async () => {
    const res = GET();
    expect(res.headers.get("Content-Type")).toBe("application/javascript; charset=utf-8");
    expect(res.headers.get("Cache-Control")).toBe("no-cache, no-store, must-revalidate");
    expect(res.headers.get("Service-Worker-Allowed")).toBe("/");
  });

  it("contains service worker lifecycle listeners and asset list", async () => {
    const res = GET();
    const text = await res.text();
    expect(text).toContain("self.addEventListener(\"install\"");
    expect(text).toContain("self.addEventListener(\"activate\"");
    expect(text).toContain("self.addEventListener(\"fetch\"");
    expect(text).toContain("/manifest.webmanifest");
  });
});