mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-13 04:01:14 +00:00
✅ Fix failed tests
This commit is contained in:
parent
ec21df156a
commit
182fb2a468
2 changed files with 5 additions and 4 deletions
|
|
@ -142,7 +142,7 @@ describe("updateComment", () => {
|
||||||
expect(octokit.graphql).toBeCalledWith(expect.any(String), {
|
expect(octokit.graphql).toBeCalledWith(expect.any(String), {
|
||||||
input: {
|
input: {
|
||||||
id: "456",
|
id: "456",
|
||||||
body: "hello there\n<!-- Sticky Pull Request CommentTypeA -->\nhello there"
|
body: "hello there\nhello there\n<!-- Sticky Pull Request CommentTypeA -->"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ function bodyWithHeader(body: string, header: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
function bodyWithoutHeader(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(
|
export async function findPreviousComment(
|
||||||
|
|
@ -92,8 +92,9 @@ export async function updateComment(
|
||||||
if (!body && !previousBody)
|
if (!body && !previousBody)
|
||||||
return core.warning("Comment body cannot be blank")
|
return core.warning("Comment body cannot be blank")
|
||||||
|
|
||||||
if (previousBody)
|
const rawPreviousBody: String = previousBody
|
||||||
let rawPreviousBody = bodyWithoutHeader(previousBody, header)
|
? bodyWithoutHeader(previousBody, header)
|
||||||
|
: ""
|
||||||
|
|
||||||
await octokit.graphql(
|
await octokit.graphql(
|
||||||
`
|
`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue