Improve content compatibility messages for structured content matching
Co-authored-by: me <me@kentcdodds.com>
This commit is contained in:
parent
78fd8949df
commit
1756b010d8
2 changed files with 12 additions and 6 deletions
|
|
@ -27,7 +27,7 @@ const checkContentCompatibility = (
|
|||
if (textBlocks.length === 0) {
|
||||
return {
|
||||
isCompatible: false,
|
||||
message: "No text blocks found",
|
||||
message: "No text blocks to match structured content",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ const checkContentCompatibility = (
|
|||
if (isEqual) {
|
||||
return {
|
||||
isCompatible: true,
|
||||
message: `Matching JSON found${textBlocks.length > 1 ? " (multiple blocks)" : ""}${unstructuredContent.length > textBlocks.length ? " + other content" : ""}`,
|
||||
message: `Structured content matches text block${textBlocks.length > 1 ? " (multiple blocks)" : ""}${unstructuredContent.length > textBlocks.length ? " + other content" : ""}`,
|
||||
};
|
||||
}
|
||||
} catch {
|
||||
|
|
@ -57,7 +57,7 @@ const checkContentCompatibility = (
|
|||
|
||||
return {
|
||||
isCompatible: false,
|
||||
message: "No matching JSON found",
|
||||
message: "No text block matches structured content",
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -354,7 +354,9 @@ describe("ToolsTab", () => {
|
|||
});
|
||||
|
||||
// Should show compatibility result
|
||||
expect(screen.getByText(/matching json/i)).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText(/structured content matches/i),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should accept multiple content blocks with structured output", () => {
|
||||
|
|
@ -374,7 +376,9 @@ describe("ToolsTab", () => {
|
|||
});
|
||||
|
||||
// Should show compatible result with multiple blocks
|
||||
expect(screen.getByText(/matching json.*multiple/i)).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText(/structured content matches.*multiple/i),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should accept mixed content types with structured output", () => {
|
||||
|
|
@ -445,7 +449,9 @@ describe("ToolsTab", () => {
|
|||
|
||||
// Should not show any compatibility messages
|
||||
expect(
|
||||
screen.queryByText(/matching json|no text blocks|no matching/i),
|
||||
screen.queryByText(
|
||||
/structured content matches|no text blocks|no.*matches/i,
|
||||
),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue