mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2026-04-28 00:18:51 +00:00
Hide details (#435)
* ✨ hide details * 📦 build * 👷 ci for hide_details option
This commit is contained in:
parent
53e089cfe2
commit
21a90c1106
12 changed files with 136 additions and 8 deletions
|
|
@ -5,6 +5,7 @@ import {
|
|||
createComment,
|
||||
deleteComment,
|
||||
findPreviousComment,
|
||||
getBodyOf,
|
||||
updateComment
|
||||
} from "../src/comment"
|
||||
|
||||
|
|
@ -177,3 +178,42 @@ it("deleteComment", async () => {
|
|||
repo: "sticky-pull-request-comment"
|
||||
})
|
||||
})
|
||||
|
||||
describe("getBodyOf", () => {
|
||||
const nullPrevious = {}
|
||||
const simplePrevious = {
|
||||
body: "hello there\n<!-- Sticky Pull Request CommentTypeA -->"
|
||||
}
|
||||
const detailsPrevious = {
|
||||
body: `
|
||||
<details open>
|
||||
<summary>title</summary>
|
||||
|
||||
content
|
||||
</details>
|
||||
<!-- Sticky Pull Request CommentTypeA -->
|
||||
`
|
||||
}
|
||||
const replaced = `
|
||||
<details>
|
||||
<summary>title</summary>
|
||||
|
||||
content
|
||||
</details>
|
||||
<!-- Sticky Pull Request CommentTypeA -->
|
||||
`
|
||||
test.each`
|
||||
append | hideDetails | previous | expected
|
||||
${false} | ${false} | ${detailsPrevious} | ${undefined}
|
||||
${true} | ${false} | ${nullPrevious} | ${undefined}
|
||||
${true} | ${false} | ${detailsPrevious} | ${detailsPrevious.body}
|
||||
${true} | ${true} | ${nullPrevious} | ${undefined}
|
||||
${true} | ${true} | ${simplePrevious} | ${simplePrevious.body}
|
||||
${true} | ${true} | ${detailsPrevious} | ${replaced}
|
||||
`(
|
||||
"receive $previous, $append, $hideDetails and returns $expected",
|
||||
({append, hideDetails, previous, expected}) => {
|
||||
expect(getBodyOf(previous, append, hideDetails)).toEqual(expected)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue