mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
test: strengthen Mistral test to verify tool message contains merged text
- Add explicit assertions verifying merged environment_details in tool message - Add assertion confirming no user message follows tool (Mistral constraint) - Reference mistral_common validator constraint in comment
This commit is contained in:
parent
367ec5f00d
commit
914cc4e73e
1 changed files with 11 additions and 7 deletions
|
|
@ -1195,15 +1195,19 @@ describe("OpenAiHandler", () => {
|
|||
|
||||
// Assert tool message exists - test setup should always produce a tool message
|
||||
expect(toolMessageIndex).not.toBe(-1)
|
||||
const toolMessage = messages[toolMessageIndex]
|
||||
|
||||
// The message after tool should be the next user message from a new request,
|
||||
// not a user message with environment_details (which should be merged)
|
||||
// Verify the tool message contains both the original content AND the merged environment_details
|
||||
// This is the key verification that mergeToolResultText is working correctly
|
||||
expect(toolMessage.content).toContain("File content here")
|
||||
expect(toolMessage.content).toContain("environment_details")
|
||||
|
||||
// Verify there is NO user message immediately after the tool message
|
||||
// This is the Mistral constraint: after tool, only assistant or tool is allowed, never user
|
||||
// Per mistral_common validator: elif previous_role == Roles.tool: expected_roles = {Roles.assistant, Roles.tool}
|
||||
const nextMessage = messages[toolMessageIndex + 1]
|
||||
// If there's a next message, it should not be a user message containing environment_details
|
||||
if (nextMessage && nextMessage.role === "user") {
|
||||
const content =
|
||||
typeof nextMessage.content === "string" ? nextMessage.content : JSON.stringify(nextMessage.content)
|
||||
expect(content).not.toContain("environment_details")
|
||||
if (nextMessage) {
|
||||
expect(nextMessage.role).not.toBe("user")
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue