mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-24 07:24:12 +08:00
Refactor tests to remove redundancy and improve structure
- Remove redundant 'mixed input patterns' test from sanitizer.test.ts - Consolidate integration tests into 2 focused real-world scenarios - Add HTML comment stripping to sanitizeContent function - Update test expectations to match sanitization behavior - Maintain full coverage with fewer, more focused tests
This commit is contained in:
@@ -172,6 +172,7 @@ describe("sanitizeContent", () => {
|
||||
|
||||
const sanitized = sanitizeContent(testContent);
|
||||
|
||||
expect(sanitized).not.toContain("<!-- This is a comment -->");
|
||||
expect(sanitized).not.toContain("example alt text");
|
||||
expect(sanitized).not.toContain("example image description");
|
||||
expect(sanitized).not.toContain("example title");
|
||||
@@ -240,23 +241,6 @@ describe("sanitizeContent", () => {
|
||||
expect(sanitized).toContain("<div>Test</div>");
|
||||
});
|
||||
|
||||
it("should handle mixed input patterns", () => {
|
||||
const mixedInput = `
|
||||

|
||||
<img alt="example" src="pic.jpg">
|
||||
[link](url.com "title\u202Ewith\u202Ccharacters")
|
||||
<span data-cmd="data value" aria-label="label text">visible text</span>
|
||||
`;
|
||||
|
||||
const sanitized = sanitizeContent(mixedInput);
|
||||
|
||||
expect(sanitized).not.toContain("example");
|
||||
expect(sanitized).not.toContain("characters");
|
||||
expect(sanitized).not.toContain("title");
|
||||
expect(sanitized).not.toContain("data value");
|
||||
expect(sanitized).not.toContain("label text");
|
||||
expect(sanitized).toContain("visible text");
|
||||
});
|
||||
});
|
||||
|
||||
describe("stripHtmlComments (legacy)", () => {
|
||||
|
||||
Reference in New Issue
Block a user