- {props.image ? (
-
+
+
+
+ {image ? (
+
) : (
-
)}
-
-
{props.name}
-
- Owner:
- {props.firstName}
-
-
- {props.lastName}
-
-
-
-
+
+
+ {name}
+
+
+ {description}
+
+ {address && address.city && (
+
+
+ {address.line1},
+ {address.city},
+ {address.countryCode}
+
+
+ )}
+
+ {tCommon('admins')}: {admins?.length}
+ {tCommon('members')}: {members?.length}
+
+
-
+ {membershipRequestStatus ==='accepted' && (
+
+ )}
+
+ {membershipRequestStatus === 'pending' && (
+
+ )}
+
+ {membershipRequestStatus === '' && (
+
+ )}
+
);
}
-export default OrganizationCard;
+export default OrganizationCard;
\ No newline at end of file
diff --git a/src/screens/OrganizationTags/OrganizationTags.spec.tsx b/src/screens/OrganizationTags/OrganizationTags.spec.tsx
index c35b69f631..0654c9a205 100644
--- a/src/screens/OrganizationTags/OrganizationTags.spec.tsx
+++ b/src/screens/OrganizationTags/OrganizationTags.spec.tsx
@@ -48,6 +48,8 @@ vi.mock('react-toastify', () => ({
toast: {
success: vi.fn(),
error: vi.fn(),
+ warn: vi.fn(),
+ info: vi.fn(),
},
}));
@@ -272,26 +274,51 @@ describe('Organisation Tags Page', () => {
test('creates a new user tag', async () => {
renderOrganizationTags(link);
- await wait();
-
+ // Wait for initial render
await waitFor(() => {
expect(screen.getByTestId('createTagBtn')).toBeInTheDocument();
});
- userEvent.click(screen.getByTestId('createTagBtn'));
- userEvent.click(screen.getByTestId('createTagSubmitBtn'));
+ // Open create tag modal
+ await act(async () => {
+ userEvent.click(screen.getByTestId('createTagBtn'));
+ });
+
+ // Wait for modal to be visible
+ await waitFor(() => {
+ expect(screen.getByTestId('createTagSubmitBtn')).toBeInTheDocument();
+ });
+
+ // Before submitting the form, we'll verify it exists
+ const form = screen.getByTestId('createTagSubmitBtn').closest('form');
+ if (form == null) {
+ throw new Error('Form not found');
+ }
+
+ // Submit empty form
+ await act(async () => {
+ fireEvent.submit(form); // No non-null assertion here
+ });
+ // Wait for error toast
await waitFor(() => {
expect(toast.error).toHaveBeenCalledWith(translations.enterTagName);
});
- userEvent.type(
- screen.getByPlaceholderText(translations.tagNamePlaceholder),
- 'userTag 12',
- );
+ // Type tag name
+ await act(async () => {
+ userEvent.type(
+ screen.getByPlaceholderText(translations.tagNamePlaceholder),
+ 'userTag 12',
+ );
+ });
- userEvent.click(screen.getByTestId('createTagSubmitBtn'));
+ // Submit form with valid data
+ await act(async () => {
+ fireEvent.submit(form); // Again, no non-null assertion here
+ });
+ // Wait for success toast
await waitFor(() => {
expect(toast.success).toHaveBeenCalledWith(
translations.tagCreationSuccess,
diff --git a/src/screens/UserPortal/Organizations/Organizations.tsx b/src/screens/UserPortal/Organizations/Organizations.tsx
index 59f5500d02..9bed58310c 100644
--- a/src/screens/UserPortal/Organizations/Organizations.tsx
+++ b/src/screens/UserPortal/Organizations/Organizations.tsx
@@ -251,7 +251,11 @@ export default function organizations(): JSX.Element {
)
)
membershipRequestStatus = 'pending';
- return { ...organization, membershipRequestStatus };
+ return {
+ ...organization,
+ membershipRequestStatus,
+ isJoined: false,
+ };
},
);
setOrganizations(organizations);
@@ -259,7 +263,13 @@ export default function organizations(): JSX.Element {
} else if (mode === 1) {
if (joinedOrganizationsData && joinedOrganizationsData.users.length > 0) {
const organizations =
- joinedOrganizationsData.users[0]?.user?.joinedOrganizations || [];
+ joinedOrganizationsData.users[0]?.user?.joinedOrganizations.map(
+ (org: InterfaceOrganization) => ({
+ ...org,
+ membershipRequestStatus: 'accepted',
+ isJoined: true,
+ }),
+ ) || [];
setOrganizations(organizations);
}
} else if (mode === 2) {
@@ -268,8 +278,13 @@ export default function organizations(): JSX.Element {
createdOrganizationsData.users.length > 0
) {
const organizations =
- createdOrganizationsData.users[0]?.appUserProfile
- ?.createdOrganizations || [];
+ createdOrganizationsData.users[0]?.appUserProfile?.createdOrganizations.map(
+ (org: InterfaceOrganization) => ({
+ ...org,
+ membershipRequestStatus: 'accepted',
+ isJoined: true,
+ }),
+ ) || [];
setOrganizations(organizations);
}
}
diff --git a/talawa-admin b/talawa-admin
new file mode 160000
index 0000000000..ba4d344312
--- /dev/null
+++ b/talawa-admin
@@ -0,0 +1 @@
+Subproject commit ba4d3443123886e380d78ecfa91ba85ec6fd4294