]> Untitled Git - lemmy.git/blobdiff - api_tests/src/community.spec.ts
First pass at adding comment trees. (#2362)
[lemmy.git] / api_tests / src / community.spec.ts
index e1f6825ae8ab9fc369061b26309984d314b12572..723f3bb3f543e5699c83b71466f616d9d0fc5d34 100644 (file)
@@ -1,4 +1,6 @@
 jest.setTimeout(120000);
+import { CommunityView } from 'lemmy-js-client';
+
 import {
   alpha,
   beta,
@@ -10,7 +12,6 @@ import {
   getCommunity,
   followCommunity,
 } from './shared';
-import { CommunityView } from 'lemmy-js-client';
 
 beforeAll(async () => {
   await setupLogins();
@@ -23,11 +24,11 @@ function assertCommunityFederation(
   expect(communityOne.community.actor_id).toBe(communityTwo.community.actor_id);
   expect(communityOne.community.name).toBe(communityTwo.community.name);
   expect(communityOne.community.title).toBe(communityTwo.community.title);
-  expect(communityOne.community.description).toBe(
-    communityTwo.community.description
+  expect(communityOne.community.description.unwrapOr("none")).toBe(
+    communityTwo.community.description.unwrapOr("none")
   );
-  expect(communityOne.community.icon).toBe(communityTwo.community.icon);
-  expect(communityOne.community.banner).toBe(communityTwo.community.banner);
+  expect(communityOne.community.icon.unwrapOr("none")).toBe(communityTwo.community.icon.unwrapOr("none"));
+  expect(communityOne.community.banner.unwrapOr("none")).toBe(communityTwo.community.banner.unwrapOr("none"));
   expect(communityOne.community.published).toBe(
     communityTwo.community.published
   );
@@ -47,7 +48,7 @@ test('Create community', async () => {
 
   // Cache the community on beta, make sure it has the other fields
   let searchShort = `!${prevName}@lemmy-alpha:8541`;
-  let betaCommunity = (await resolveCommunity(beta, searchShort)).community;
+  let betaCommunity = (await resolveCommunity(beta, searchShort)).community.unwrap();
   assertCommunityFederation(betaCommunity, communityRes.community_view);
 });
 
@@ -56,7 +57,7 @@ test('Delete community', async () => {
 
   // Cache the community on Alpha
   let searchShort = `!${communityRes.community_view.community.name}@lemmy-beta:8551`;
-  let alphaCommunity = (await resolveCommunity(alpha, searchShort)).community;
+  let alphaCommunity = (await resolveCommunity(alpha, searchShort)).community.unwrap();
   assertCommunityFederation(alphaCommunity, communityRes.community_view);
 
   // Follow the community from alpha
@@ -107,7 +108,7 @@ test('Remove community', async () => {
 
   // Cache the community on Alpha
   let searchShort = `!${communityRes.community_view.community.name}@lemmy-beta:8551`;
-  let alphaCommunity = (await resolveCommunity(alpha, searchShort)).community;
+  let alphaCommunity = (await resolveCommunity(alpha, searchShort)).community.unwrap();
   assertCommunityFederation(alphaCommunity, communityRes.community_view);
 
   // Follow the community from alpha
@@ -158,6 +159,6 @@ test('Search for beta community', async () => {
   expect(communityRes.community_view.community.name).toBeDefined();
 
   let searchShort = `!${communityRes.community_view.community.name}@lemmy-beta:8551`;
-  let alphaCommunity = (await resolveCommunity(alpha, searchShort)).community;
+  let alphaCommunity = (await resolveCommunity(alpha, searchShort)).community.unwrap();
   assertCommunityFederation(alphaCommunity, communityRes.community_view);
 });