mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2026-04-23 14:28:51 +00:00
Add option to skip updating or recreating comments when message is unchanged
This commit is contained in:
parent
077277a006
commit
e5439e773a
6 changed files with 96 additions and 19 deletions
|
|
@ -7,7 +7,8 @@ import {
|
|||
findPreviousComment,
|
||||
getBodyOf,
|
||||
updateComment,
|
||||
minimizeComment
|
||||
minimizeComment,
|
||||
commentsEqual
|
||||
} from "../src/comment"
|
||||
|
||||
jest.mock("@actions/core", () => ({
|
||||
|
|
@ -250,3 +251,16 @@ describe("getBodyOf", () => {
|
|||
}
|
||||
)
|
||||
})
|
||||
|
||||
describe("commentsEqual", () => {
|
||||
test.each([
|
||||
{ body: "body", previous: "body\n<!-- Sticky Pull Request Commentheader -->", header: "header", expected: true },
|
||||
{ body: "body", previous: "body\n<!-- Sticky Pull Request Comment -->", header: "", expected: true },
|
||||
{ body: "body", previous: "body\n<!-- Sticky Pull Request Commenta different header -->", header: "header", expected: false },
|
||||
{ body: "body", previous: "body", header: "header", expected: false },
|
||||
{ body: "body", previous: "", header: "header", expected: false },
|
||||
{ body: "", previous: "body", header: "header", expected: false },
|
||||
])("commentsEqual(%s, %s, %s)", ({body, previous, header, expected}) => {
|
||||
expect(commentsEqual(body, previous, header)).toEqual(expected)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue