From bb1b4ee33e75917fb16f71fb302f867dd135ccf5 Mon Sep 17 00:00:00 2001 From: Felix Date: Wed, 13 May 2020 19:21:32 +0200 Subject: Comment search and apub endpoint --- ui/src/api_tests/api.spec.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'ui/src/api_tests') 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 { -- cgit v1.2.3