summaryrefslogtreecommitdiffstats
path: root/ui/src/api_tests
diff options
context:
space:
mode:
authorFelix <me@nutomic.com>2020-05-13 19:21:32 +0200
committerFelix <me@nutomic.com>2020-05-14 12:42:26 +0200
commitbb1b4ee33e75917fb16f71fb302f867dd135ccf5 (patch)
treef80b17d0960bc06c286c60b7305ad8c9ddb60cb4 /ui/src/api_tests
parent66142c546b4a7120b94bacc18cf478ae1905fd46 (diff)
Comment search and apub endpoint
Diffstat (limited to 'ui/src/api_tests')
-rw-r--r--ui/src/api_tests/api.spec.ts32
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 {