Skip to content

Commit 6b59564

Browse files
test(webview-ui): pin exact diagnostics text and seed skills defaults in initialState
Strengthens the SkillsSettings diagnostics assertions to exact element text so the StringLiteral mutants CI reports at SkillsSettings.tsx:249 and :250 no longer survive, and seeds skills and skillDiagnostics through initialState in ExtensionStateContext.spec.tsx so the ArrowFunction, LogicalOperator and ArrayDeclaration mutants at :391 and :393 fail. Spec-only: no Stryker directive, no source change.
1 parent 9b6dc1a commit 6b59564

2 files changed

Lines changed: 57 additions & 2 deletions

File tree

‎webview-ui/src/components/settings/__tests__/SkillsSettings.spec.tsx‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,23 @@ describe("SkillsSettings", () => {
244244
message: "bad indentation of a mapping entry",
245245
line: 7,
246246
},
247+
{
248+
path: "/workspace/.roo/skills/broken-4/SKILL.md",
249+
source: "project",
250+
message: "found character that cannot start any token",
251+
line: 12,
252+
column: 3,
253+
},
247254
])
248255

249256
const warning = screen.getByRole("alert")
250-
expect(warning).toHaveTextContent("/workspace/.roo/skills/broken-2/SKILL.md")
257+
const rows = Array.from(warning.querySelectorAll("li"))
258+
expect(rows[0]?.querySelector("span")?.textContent).toBe("/workspace/.roo/skills/broken-2/SKILL.md")
259+
expect(rows[1]?.querySelector("span")?.textContent).toBe("/workspace/.roo/skills/broken-3/SKILL.md:7")
260+
expect(rows[2]?.querySelector("span")?.textContent).toBe("/workspace/.roo/skills/broken-4/SKILL.md:12:3")
251261
expect(warning).toHaveTextContent("unexpected end of the stream")
252-
expect(warning).toHaveTextContent("/workspace/.roo/skills/broken-3/SKILL.md:7")
253262
expect(warning).toHaveTextContent("bad indentation of a mapping entry")
263+
expect(warning).toHaveTextContent("found character that cannot start any token")
254264
})
255265

256266
it("displays project skills section when in a workspace", () => {

‎webview-ui/src/context/__tests__/ExtensionStateContext.spec.tsx‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
type MarketplaceItem,
1212
type MarketplaceInstalledMetadata,
1313
type RouterModels,
14+
type SkillDiagnostic,
15+
type SkillMetadata,
1416
DEFAULT_CHECKPOINT_TIMEOUT_SECONDS,
1517
DEFAULT_DIFF_FUZZY_THRESHOLD,
1618
DEFAULT_WRITE_DELAY_MS,
@@ -865,6 +867,49 @@ describe("ExtensionStateContext", () => {
865867
})
866868
})
867869

870+
it("initializes skills and skillDiagnostics from initialState", () => {
871+
const seededSkills: SkillMetadata[] = [
872+
{
873+
name: "seeded-skill",
874+
description: "A seeded skill",
875+
path: "/workspace/.roo/skills/seeded-skill/SKILL.md",
876+
source: "project",
877+
},
878+
]
879+
const seededDiagnostics: SkillDiagnostic[] = [
880+
{
881+
path: "/workspace/.roo/skills/seeded-skill/SKILL.md",
882+
source: "project",
883+
message: "bad indentation of a mapping entry",
884+
line: 2,
885+
},
886+
]
887+
888+
render(
889+
<ExtensionStateContextProvider initialState={{ skills: seededSkills, skillDiagnostics: seededDiagnostics }}>
890+
<SkillsTestComponent />
891+
</ExtensionStateContextProvider>,
892+
)
893+
894+
expect(JSON.parse(screen.getByTestId("skills").textContent!)).toEqual([
895+
expect.objectContaining({ name: "seeded-skill" }),
896+
])
897+
expect(JSON.parse(screen.getByTestId("skill-diagnostics").textContent!)).toEqual([
898+
expect.objectContaining({ path: "/workspace/.roo/skills/seeded-skill/SKILL.md" }),
899+
])
900+
})
901+
902+
it("defaults skills and skillDiagnostics to empty arrays when initialState omits them", () => {
903+
render(
904+
<ExtensionStateContextProvider initialState={{}}>
905+
<SkillsTestComponent />
906+
</ExtensionStateContextProvider>,
907+
)
908+
909+
expect(JSON.parse(screen.getByTestId("skills").textContent!)).toEqual([])
910+
expect(JSON.parse(screen.getByTestId("skill-diagnostics").textContent!)).toEqual([])
911+
})
912+
868913
it("updates showRooIgnoredFiles through setShowRooIgnoredFiles", () => {
869914
render(
870915
<ExtensionStateContextProvider>

0 commit comments

Comments
 (0)