mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2026-04-22 05:55:43 +00:00
add option to delete the previous comment and create a new one
This commit is contained in:
parent
7235ddcfc1
commit
2f6d0e21be
4 changed files with 49 additions and 7 deletions
|
|
@ -1,7 +1,8 @@
|
|||
import {
|
||||
findPreviousComment,
|
||||
createComment,
|
||||
updateComment
|
||||
updateComment,
|
||||
deleteComment
|
||||
} from "../src/comment";
|
||||
const repo = {};
|
||||
it("findPreviousComment", async () => {
|
||||
|
|
@ -97,3 +98,30 @@ it("createComment", async () => {
|
|||
body: "<!-- Sticky Pull Request CommentTypeA -->\nhello there"
|
||||
});
|
||||
});
|
||||
|
||||
it("removeComment", async () => {
|
||||
const octokit = {
|
||||
issues: {
|
||||
deleteComment: jest.fn(() => Promise.resolve())
|
||||
}
|
||||
};
|
||||
expect(
|
||||
await deleteComment(octokit, repo, 456)
|
||||
).toBeUndefined();
|
||||
expect(octokit.issues.deleteComment).toBeCalledWith({
|
||||
comment_id: 456
|
||||
});
|
||||
expect(
|
||||
await deleteComment(octokit, repo, 456)
|
||||
).toBeUndefined();
|
||||
expect(octokit.issues.deleteComment).toBeCalledWith({
|
||||
comment_id: 456
|
||||
});
|
||||
|
||||
expect(
|
||||
await deleteComment(octokit, repo, 456)
|
||||
).toBeUndefined();
|
||||
expect(octokit.issues.deleteComment).toBeCalledWith({
|
||||
comment_id: 456
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue