mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-11 05:11:49 +01:00
Cover multiline validator passthrough cases
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
84f97c8a67
commit
025cfbdcb0
2 files changed
+32
No files matched your search
@@ -6,6 +6,20 @@ import {
|
||||
} from "./approval.js";
|
||||
|
||||
describe("approval validators", () => {
|
||||
it("passes real line breaks through unchanged", () => {
|
||||
expect(addApprovalCommentSchema.parse({ body: "Looks good\n\nApproved." }).body)
|
||||
.toBe("Looks good\n\nApproved.");
|
||||
expect(resolveApprovalSchema.parse({ decisionNote: "Decision\n\nApproved." }).decisionNote)
|
||||
.toBe("Decision\n\nApproved.");
|
||||
});
|
||||
|
||||
it("accepts null and omitted optional decision notes", () => {
|
||||
expect(resolveApprovalSchema.parse({ decisionNote: null }).decisionNote).toBeNull();
|
||||
expect(resolveApprovalSchema.parse({}).decisionNote).toBeUndefined();
|
||||
expect(requestApprovalRevisionSchema.parse({ decisionNote: null }).decisionNote).toBeNull();
|
||||
expect(requestApprovalRevisionSchema.parse({}).decisionNote).toBeUndefined();
|
||||
});
|
||||
|
||||
it("normalizes escaped line breaks in approval comments and decision notes", () => {
|
||||
expect(addApprovalCommentSchema.parse({ body: "Looks good\\n\\nApproved." }).body)
|
||||
.toBe("Looks good\n\nApproved.");
|
||||
|
||||
@@ -9,6 +9,24 @@ import {
|
||||
} from "./issue.js";
|
||||
|
||||
describe("issue validators", () => {
|
||||
it("passes real line breaks through unchanged", () => {
|
||||
const parsed = createIssueSchema.parse({
|
||||
title: "Follow up PR",
|
||||
description: "Line 1\n\nLine 2",
|
||||
});
|
||||
|
||||
expect(parsed.description).toBe("Line 1\n\nLine 2");
|
||||
});
|
||||
|
||||
it("accepts null and omitted optional multiline issue fields", () => {
|
||||
expect(createIssueSchema.parse({ title: "Follow up PR", description: null }).description)
|
||||
.toBeNull();
|
||||
expect(createIssueSchema.parse({ title: "Follow up PR" }).description)
|
||||
.toBeUndefined();
|
||||
expect(updateIssueSchema.parse({ comment: undefined }).comment)
|
||||
.toBeUndefined();
|
||||
});
|
||||
|
||||
it("normalizes JSON-escaped line breaks in issue descriptions", () => {
|
||||
const parsed = createIssueSchema.parse({
|
||||
title: "Follow up PR",
|
||||
|
||||
Reference in new issue
Block a user