Some checks failed
Test Custom Executables / test-custom-executables (push) Has been cancelled
CI / test (push) Has been cancelled
CI / prettier (push) Has been cancelled
CI / typecheck (push) Has been cancelled
Sync Base Action to claude-code-base-action / Sync base-action to claude-code-base-action repository (push) Has been cancelled
Test Claude Code Action / test-inline-prompt (push) Has been cancelled
Test Claude Code Action / test-prompt-file (push) Has been cancelled
Test Claude Env Feature / test-claude-env-with-comments (push) Has been cancelled
Test MCP Servers / test-mcp-integration (push) Has been cancelled
Test MCP Servers / test-mcp-config-flag (push) Has been cancelled
Test Settings Feature / test-settings-inline-allow (push) Has been cancelled
Test Settings Feature / test-settings-inline-deny (push) Has been cancelled
Test Settings Feature / test-settings-file-allow (push) Has been cancelled
Test Settings Feature / test-settings-file-deny (push) Has been cancelled
Fork of markwylde/claude-code-gitea-action@b744372 (v1.0.21) with the 'View job' link fixed to use GITHUB_RUN_NUMBER (per-repo index) instead of GITHUB_RUN_ID (global id), because Forgejo routes run pages by per-repo index. See VENDOR.txt.
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { describe, test, expect } from "bun:test";
|
|
import { getMode, isValidMode } from "../../src/modes/registry";
|
|
import type { ModeName } from "../../src/modes/types";
|
|
import { tagMode } from "../../src/modes/tag";
|
|
import { agentMode } from "../../src/modes/agent";
|
|
|
|
describe("Mode Registry", () => {
|
|
test("getMode returns tag mode by default", () => {
|
|
const mode = getMode("tag");
|
|
expect(mode).toBe(tagMode);
|
|
expect(mode.name).toBe("tag");
|
|
});
|
|
|
|
test("getMode returns agent mode", () => {
|
|
const mode = getMode("agent");
|
|
expect(mode).toBe(agentMode);
|
|
expect(mode.name).toBe("agent");
|
|
});
|
|
|
|
test("getMode throws error for invalid mode", () => {
|
|
const invalidMode = "invalid" as unknown as ModeName;
|
|
expect(() => getMode(invalidMode)).toThrow(
|
|
"Invalid mode 'invalid'. Valid modes are: 'tag', 'agent'. Please check your workflow configuration.",
|
|
);
|
|
});
|
|
|
|
test("isValidMode returns true for all valid modes", () => {
|
|
expect(isValidMode("tag")).toBe(true);
|
|
expect(isValidMode("agent")).toBe(true);
|
|
});
|
|
|
|
test("isValidMode returns false for invalid mode", () => {
|
|
expect(isValidMode("invalid")).toBe(false);
|
|
expect(isValidMode("review")).toBe(false);
|
|
});
|
|
});
|