diff options
author | Dessalines <tyhou13@gmx.com> | 2020-05-14 18:35:29 -0400 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-05-14 18:35:29 -0400 |
commit | 3a4973ad68562f9ccb4a9f4442333e0478bc7b04 (patch) | |
tree | 6c330132daaf59daf1125614a41884bb9fa5d1eb /ui/src/api_tests | |
parent | 0fb8450e56da430ece7502ecde085d4c3a2e2ff2 (diff) | |
parent | bb1b4ee33e75917fb16f71fb302f867dd135ccf5 (diff) |
Merge branch 'federation' into yerba_refactoring
Diffstat (limited to 'ui/src/api_tests')
-rw-r--r-- | ui/src/api_tests/api.spec.ts | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/ui/src/api_tests/api.spec.ts b/ui/src/api_tests/api.spec.ts index 8734169a..dcfb5e62 100644 --- a/ui/src/api_tests/api.spec.ts +++ b/ui/src/api_tests/api.spec.ts @@ -68,7 +68,7 @@ describe('main', () => { lemmyBetaAuth = resB.jwt; }); - describe('beta_fetch', () => { + describe('post_search', () => { test('Create test post on alpha and fetch it on beta', async () => { let name = 'A jest test post'; let postForm: PostForm = { @@ -1107,6 +1107,36 @@ describe('main', () => { expect(getPrivateMessagesUnDeletedRes.messages[0].deleted).toBe(false); }); }); + + describe('comment_search', () => { + test('Create comment on alpha and search it', async () => { + let content = 'A jest test federated comment for search'; + let commentForm: CommentForm = { + content, + post_id: 1, + auth: lemmyAlphaAuth, + }; + + let createResponse: CommentResponse = await fetch( + `${lemmyAlphaApiUrl}/comment`, + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: wrapper(commentForm), + } + ).then(d => d.json()); + + let searchUrl = `${lemmyBetaApiUrl}/search?q=${createResponse.comment.ap_id}&type_=All&sort=TopAll`; + let searchResponse: SearchResponse = await fetch(searchUrl, { + method: 'GET', + }).then(d => d.json()); + + // TODO: check more fields + expect(searchResponse.comments[0].content).toBe(content); + }); + }); }); function wrapper(form: any): string { |