Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

1.4 KB
Raw Blame
/**
 * R-02 — AutoStartToggle unit tests.
 *
 * Verifies module shape for the extracted shared component.
 */

import { describe, it } from "node:test";
import assert from "node:assert/strict";

describe("AutoStartToggle — module shape", () => {
  it("exports AutoStartToggle function", async () => {
    const mod =
      await import("../../../../../src/app/(dashboard)/dashboard/providers/services/components/AutoStartToggle.tsx");
    assert.equal(typeof mod.AutoStartToggle, "function");
  });
});

// ── default label/description logic (mirrors component defaults) ──────────────

describe("AutoStartToggle — default description", () => {
  it("description uses service name when not provided", () => {
    const name = "cliproxy";
    const description = `Launch ${name} automatically when OmniRoute starts`;
    assert.ok(description.includes(name));
    assert.ok(description.includes("OmniRoute"));
  });

  it("auto-start endpoint path is correct for any service name", () => {
    const name = "cliproxy";
    const path = `/api/services/${name}/auto-start`;
    assert.equal(path, "/api/services/cliproxy/auto-start");
  });

  it("auto-start endpoint path is correct for 9router", () => {
    const name = "9router";
    const path = `/api/services/${name}/auto-start`;
    assert.equal(path, "/api/services/9router/auto-start");
  });
});