Prettier backfill

This commit is contained in:
Matt Rubens
2025-01-17 14:11:28 -05:00
parent 3bcb4ff8c5
commit 60a0a824b9
174 changed files with 15715 additions and 15428 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,52 +1,52 @@
import { Mode, isToolAllowedForMode, TestToolName, getModeConfig, modes } from '../../shared/modes';
import { validateToolUse } from '../mode-validator';
import { Mode, isToolAllowedForMode, TestToolName, getModeConfig, modes } from "../../shared/modes"
import { validateToolUse } from "../mode-validator"
const asTestTool = (tool: string): TestToolName => tool as TestToolName;
const [codeMode, architectMode, askMode] = modes.map(mode => mode.slug);
const asTestTool = (tool: string): TestToolName => tool as TestToolName
const [codeMode, architectMode, askMode] = modes.map((mode) => mode.slug)
describe('mode-validator', () => {
describe('isToolAllowedForMode', () => {
describe('code mode', () => {
it('allows all code mode tools', () => {
const mode = getModeConfig(codeMode);
mode.tools.forEach(([tool]) => {
expect(isToolAllowedForMode(tool, codeMode)).toBe(true)
})
})
describe("mode-validator", () => {
describe("isToolAllowedForMode", () => {
describe("code mode", () => {
it("allows all code mode tools", () => {
const mode = getModeConfig(codeMode)
mode.tools.forEach(([tool]) => {
expect(isToolAllowedForMode(tool, codeMode)).toBe(true)
})
})
it('disallows unknown tools', () => {
expect(isToolAllowedForMode(asTestTool('unknown_tool'), codeMode)).toBe(false)
})
})
it("disallows unknown tools", () => {
expect(isToolAllowedForMode(asTestTool("unknown_tool"), codeMode)).toBe(false)
})
})
describe('architect mode', () => {
it('allows configured tools', () => {
const mode = getModeConfig(architectMode);
mode.tools.forEach(([tool]) => {
expect(isToolAllowedForMode(tool, architectMode)).toBe(true)
})
})
})
describe("architect mode", () => {
it("allows configured tools", () => {
const mode = getModeConfig(architectMode)
mode.tools.forEach(([tool]) => {
expect(isToolAllowedForMode(tool, architectMode)).toBe(true)
})
})
})
describe('ask mode', () => {
it('allows configured tools', () => {
const mode = getModeConfig(askMode);
mode.tools.forEach(([tool]) => {
expect(isToolAllowedForMode(tool, askMode)).toBe(true)
})
})
})
})
describe("ask mode", () => {
it("allows configured tools", () => {
const mode = getModeConfig(askMode)
mode.tools.forEach(([tool]) => {
expect(isToolAllowedForMode(tool, askMode)).toBe(true)
})
})
})
})
describe('validateToolUse', () => {
it('throws error for disallowed tools in architect mode', () => {
expect(() => validateToolUse('unknown_tool', 'architect')).toThrow(
'Tool "unknown_tool" is not allowed in architect mode.'
)
})
describe("validateToolUse", () => {
it("throws error for disallowed tools in architect mode", () => {
expect(() => validateToolUse("unknown_tool", "architect")).toThrow(
'Tool "unknown_tool" is not allowed in architect mode.',
)
})
it('does not throw for allowed tools in architect mode', () => {
expect(() => validateToolUse('read_file', 'architect')).not.toThrow()
})
})
})
it("does not throw for allowed tools in architect mode", () => {
expect(() => validateToolUse("read_file", "architect")).not.toThrow()
})
})
})