mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
fix: address code review feedback
- Replace unused showSuggestions state with SHOW_SUGGESTIONS constant - Fix parseCommandAndOutput import name consistency - Add test coverage for fallback case where command equals text
This commit is contained in:
parent
b24400b549
commit
860631cfe3
2 changed files with 27 additions and 3 deletions
|
|
@ -16,7 +16,7 @@ import { CommandPatternSelector } from "./CommandPatternSelector"
|
|||
import {
|
||||
extractCommandPatterns,
|
||||
getPatternDescription,
|
||||
parseCommandAndOutput as parseCommandAndOutputUtil,
|
||||
parseCommandAndOutput,
|
||||
CommandPattern,
|
||||
} from "../../utils/commandPatterns"
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec
|
|||
suggestions,
|
||||
} = useMemo(() => {
|
||||
// Use the enhanced parser from commandPatterns
|
||||
return parseCommandAndOutputUtil(text || "")
|
||||
return parseCommandAndOutput(text || "")
|
||||
}, [text])
|
||||
|
||||
// If we aren't opening the VSCode terminal for this command then we default
|
||||
|
|
@ -64,7 +64,7 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec
|
|||
|
||||
// Use AI suggestions if available
|
||||
if (suggestions.length > 0) {
|
||||
suggestions.forEach((suggestion) => {
|
||||
suggestions.forEach((suggestion: string) => {
|
||||
patterns.push({
|
||||
pattern: suggestion,
|
||||
description: getPatternDescription(suggestion),
|
||||
|
|
|
|||
|
|
@ -463,5 +463,29 @@ Without any command prefix`
|
|||
expect(codeBlock.textContent).toContain("Multiple lines of output")
|
||||
expect(codeBlock.textContent).toContain("Without any command prefix")
|
||||
})
|
||||
|
||||
it("should handle fallback case where parsed command equals original text", () => {
|
||||
// This tests the case where parseCommandAndOutput returns command === text
|
||||
// which happens when there's no output separator or command prefix
|
||||
const plainCommand = "docker build ."
|
||||
|
||||
render(
|
||||
<ExtensionStateWrapper>
|
||||
<CommandExecution executionId="test-15" text={plainCommand} />
|
||||
</ExtensionStateWrapper>,
|
||||
)
|
||||
|
||||
// Should render the command
|
||||
expect(screen.getByTestId("code-block")).toHaveTextContent("docker build .")
|
||||
|
||||
// Should show pattern selector with extracted patterns
|
||||
expect(screen.getByTestId("command-pattern-selector")).toBeInTheDocument()
|
||||
expect(screen.getByText("docker")).toBeInTheDocument()
|
||||
expect(screen.getByText("docker build")).toBeInTheDocument()
|
||||
|
||||
// Verify no output is shown (since command === text means no output)
|
||||
const codeBlocks = screen.getAllByTestId("code-block")
|
||||
expect(codeBlocks).toHaveLength(1) // Only the command block, no output block
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue