diff --git a/app/soapbox/features/group/components/__tests__/group-relationship.test.tsx b/app/soapbox/features/group/components/__tests__/group-relationship.test.tsx
new file mode 100644
index 0000000000..4c6c10a489
--- /dev/null
+++ b/app/soapbox/features/group/components/__tests__/group-relationship.test.tsx
@@ -0,0 +1,66 @@
+import React from 'react';
+
+import { buildGroup, buildGroupRelationship } from 'soapbox/jest/factory';
+import { render, screen } from 'soapbox/jest/test-helpers';
+import { GroupRoles } from 'soapbox/schemas/group-member';
+import { Group } from 'soapbox/types/entities';
+
+import GroupRelationship from '../group-relationship';
+
+let group: Group;
+
+describe('', () => {
+ describe('when the user is an admin', () => {
+ beforeEach(() => {
+ group = buildGroup({
+ relationship: buildGroupRelationship({
+ requested: false,
+ member: true,
+ role: GroupRoles.ADMIN,
+ }),
+ });
+ });
+
+ it('should render the relationship', () => {
+ render();
+
+ expect(screen.getByTestId('group-relationship')).toHaveTextContent('Admin');
+ });
+ });
+
+ describe('when the user is an owner', () => {
+ beforeEach(() => {
+ group = buildGroup({
+ relationship: buildGroupRelationship({
+ requested: false,
+ member: true,
+ role: GroupRoles.OWNER,
+ }),
+ });
+ });
+
+ it('should render the relationship', () => {
+ render();
+
+ expect(screen.getByTestId('group-relationship')).toHaveTextContent('Owner');
+ });
+ });
+
+ describe('when the user is a member', () => {
+ beforeEach(() => {
+ group = buildGroup({
+ relationship: buildGroupRelationship({
+ requested: false,
+ member: true,
+ role: GroupRoles.USER,
+ }),
+ });
+ });
+
+ it('should render null', () => {
+ render();
+
+ expect(screen.queryAllByTestId('group-relationship')).toHaveLength(0);
+ });
+ });
+});
\ No newline at end of file
diff --git a/app/soapbox/features/group/components/group-relationship.tsx b/app/soapbox/features/group/components/group-relationship.tsx
index c71adbbe8b..771c0a3eeb 100644
--- a/app/soapbox/features/group/components/group-relationship.tsx
+++ b/app/soapbox/features/group/components/group-relationship.tsx
@@ -13,12 +13,16 @@ const GroupRelationship = ({ group }: IGroupRelationship) => {
const isOwner = group.relationship?.role === GroupRoles.OWNER;
const isAdmin = group.relationship?.role === GroupRoles.ADMIN;
- if (!isOwner || !isAdmin) {
+ if (!isOwner && !isAdmin) {
return null;
}
return (
-
+
{
{isOwner
- ?
- : }
+ ?
+ : }
);