mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 03:11:32 +00:00
Adding a unit test for a federated comment like.
This commit is contained in:
parent
ced3cbde73
commit
b2d2553305
1 changed files with 31 additions and 0 deletions
31
ui/src/api_tests/api.spec.ts
vendored
31
ui/src/api_tests/api.spec.ts
vendored
|
@ -618,6 +618,37 @@ describe('main', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('federated comment like', () => {
|
||||
test('/u/lemmy_beta likes a comment from /u/lemmy_alpha, the like is on both instances', async () => {
|
||||
// Do a like, to test it (its also been unliked, so its at 0)
|
||||
let likeCommentForm: CommentLikeForm = {
|
||||
comment_id: 1,
|
||||
score: 1,
|
||||
auth: lemmyBetaAuth,
|
||||
};
|
||||
|
||||
let likeCommentRes: CommentResponse = await fetch(
|
||||
`${lemmyBetaApiUrl}/comment/like`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: wrapper(likeCommentForm),
|
||||
}
|
||||
).then(d => d.json());
|
||||
|
||||
expect(likeCommentRes.comment.score).toBe(1);
|
||||
|
||||
let getPostUrl = `${lemmyAlphaApiUrl}/post?id=2`;
|
||||
let getPostRes: GetPostResponse = await fetch(getPostUrl, {
|
||||
method: 'GET',
|
||||
}).then(d => d.json());
|
||||
|
||||
expect(getPostRes.comments[2].score).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('delete things', () => {
|
||||
test('/u/lemmy_beta deletes and undeletes a federated comment, post, and community, lemmy_alpha sees its deleted.', async () => {
|
||||
// Create a test community
|
||||
|
|
Loading…
Reference in a new issue