From 35d22e00ca16060b55d8f5926f30f4d0625a7825 Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Thu, 17 Jul 2025 15:54:06 -0700 Subject: [PATCH] test: update environment details tests to match XML format Updated the getEnvironmentDetails.spec.ts tests to expect XML format instead of markdown headings. The implementation was changed to use XML format with the fast-xml-parser library, but the tests were still expecting markdown format. This change updates the tests to match the new XML structure while preserving the same semantic checks. Signed-off-by: Eric Wheeler --- .../__tests__/getEnvironmentDetails.spec.ts | 63 ++++++++++--------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts index a1b8691e70..49f2108887 100644 --- a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts +++ b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts @@ -141,14 +141,13 @@ describe("getEnvironmentDetails", () => { it("should return basic environment details", async () => { const result = await getEnvironmentDetails(mockCline as Task) - expect(result).toContain("") - expect(result).toContain("") - expect(result).toContain("# VSCode Visible Files") - expect(result).toContain("# VSCode Open Tabs") - expect(result).toContain("# Current Time") - expect(result).toContain("# Current Cost") - expect(result).toContain("# Current Mode") - expect(result).toContain("test-model") + expect(result).toContain(" { it("should include file details when includeFileDetails is true", async () => { const result = await getEnvironmentDetails(mockCline as Task, true) - expect(result).toContain("# Current Workspace Directory") - expect(result).toContain("Files") + expect(result).toContain(" { const result = await getEnvironmentDetails(mockCline as Task) - expect(result).toContain("# Recently Modified Files") - expect(result).toContain("modified1.ts") - expect(result).toContain("modified2.ts") + expect(result).toContain("") + expect(result).toContain('path="modified1.ts"') + expect(result).toContain('path="modified2.ts"') }) it("should include active terminal information", async () => { @@ -229,10 +228,11 @@ describe("getEnvironmentDetails", () => { const result = await getEnvironmentDetails(mockCline as Task) - expect(result).toContain("# Actively Running Terminals") - expect(result).toContain("## Terminal terminal-1 (Active)") - expect(result).toContain("### Working Directory: `/test/path/src`") - expect(result).toContain("### Original command: `npm test`") + expect(result).toContain(" { const result = await getEnvironmentDetails(mockCline as Task) - expect(result).toContain("# Inactive Terminals with Completed Process Output") - expect(result).toContain("## Terminal terminal-2 (Inactive)") - expect(result).toContain("### Working Directory: `/test/path/build`") - expect(result).toContain("Command: `npm build`") + expect(result).toContain(" { const result = await getEnvironmentDetails(mockCline as Task) // Check active terminal working directory - expect(result).toContain("## Terminal terminal-1 (Active)") - expect(result).toContain("### Working Directory: `/some/path`") - expect(result).toContain("### Original command: `cd /some/path && npm start`") + expect(result).toContain('id="terminal-1"') + expect(result).toContain('status="Active"') + expect(result).toContain('cwd="/some/path"') + expect(result).toContain('command="cd /some/path && npm start"') // Check inactive terminal working directory - expect(result).toContain("## Terminal terminal-2 (Inactive)") - expect(result).toContain("### Working Directory: `/another/path`") + expect(result).toContain('id="terminal-2"') + expect(result).toContain('status="Inactive"') + expect(result).toContain('cwd="/another/path"') // Verify the methods were called expect(mockActiveTerminal.getCurrentWorkingDirectory).toHaveBeenCalled() @@ -319,8 +322,9 @@ describe("getEnvironmentDetails", () => { const result = await getEnvironmentDetails(mockCline as Task) - expect(result).toContain("You are a code assistant") - expect(result).toContain("Custom instructions") + expect(result).toContain(" { @@ -341,8 +345,7 @@ describe("getEnvironmentDetails", () => { const result2 = await getEnvironmentDetails(mockCline as Task) // Verify the function still returns a result. - expect(result2).toContain("") - expect(result2).toContain("") + expect(result2).toContain(" {