Fix failed tests

This commit is contained in:
marocchino 2024-07-23 07:44:12 +09:00
parent ec21df156a
commit 182fb2a468
No known key found for this signature in database
GPG key ID: F54107506CCF18D0
2 changed files with 5 additions and 4 deletions

View file

@ -142,7 +142,7 @@ describe("updateComment", () => {
expect(octokit.graphql).toBeCalledWith(expect.any(String), {
input: {
id: "456",
body: "hello there\n<!-- Sticky Pull Request CommentTypeA -->\nhello there"
body: "hello there\nhello there\n<!-- Sticky Pull Request CommentTypeA -->"
}
})
})

View file

@ -20,7 +20,7 @@ function bodyWithHeader(body: string, header: string): string {
}
function bodyWithoutHeader(body: string, header: string): string {
return body.replace(`\n${headerComment(header)}`, "");
return body.replace(`\n${headerComment(header)}`, "")
}
export async function findPreviousComment(
@ -92,8 +92,9 @@ export async function updateComment(
if (!body && !previousBody)
return core.warning("Comment body cannot be blank")
if (previousBody)
let rawPreviousBody = bodyWithoutHeader(previousBody, header)
const rawPreviousBody: String = previousBody
? bodyWithoutHeader(previousBody, header)
: ""
await octokit.graphql(
`