Skip to content

Commit

Permalink
Update LeftDrawerOrg.test.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
ARYANSHAH1567 authored Oct 22, 2024
1 parent 7559143 commit 04e782a
Showing 1 changed file with 61 additions and 84 deletions.
145 changes: 61 additions & 84 deletions src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,45 @@ import useLocalStorage from 'utils/useLocalstorage';
const { setItem } = useLocalStorage();

const props: InterfaceLeftDrawerProps = {
orgId: '123',
orgId: '64378abd85008f171cf2990d',
targets: [
{
name: 'Dashboard',
url: '/orgdash/123',
url: '/orgdash/6437904485008f171cf29924',
},
{
name: 'People',
url: '/orgpeople/123',
url: '/orgpeople/6437904485008f171cf29924',
},
{
name: 'Events',
url: '/orgevents/123',
url: '/orgevents/6437904485008f171cf29924',
},
{
name: 'Posts',
url: '/orgpost/123',
url: '/orgpost/6437904485008f171cf29924',
},
{
name: 'Block/Unblock',
url: '/blockuser/123',
url: '/blockuser/6437904485008f171cf29924',
},
{
name: 'Plugins',
subTargets: [
{
name: 'Plugin Store',
url: '/orgstore/123',
url: '/orgstore/6437904485008f171cf29924',
icon: 'fa-store',
},
],
},
{
name: 'Settings',
url: '/orgsetting/123',
url: '/orgsetting/6437904485008f171cf29924',
},
{
name: 'All Organizations',
url: '/orglist/123',
url: '/orglist/6437904485008f171cf29924',
},
],
hideDrawer: false,
Expand All @@ -78,58 +78,47 @@ const MOCKS = [
{
request: {
query: ORGANIZATIONS_LIST_BY_CREATOR_ID,
variables: { id: '123' },
variables: { id: '64378abd85008f171cf2990d' },
},
result: {
data: {
organizations: [
{
_id: '123',
_id: '6437904485008f171cf29924',
image: null,
creator: {
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
},
name: 'Test Organization',
description: 'Testing this organization',
name: 'Unity Foundation',
description: 'A foundation aimed at uniting the world and making it a better place for all.',
address: {
city: 'Delhi',
countryCode: 'IN',
city: 'Bronx',
countryCode: 'US',
dependentLocality: 'Some Dependent Locality',
line1: '123 Random Street',
line2: 'Apartment 456',
postalCode: '110001',
postalCode: '10451',
sortingCode: 'ABC-123',
state: 'Delhi',
state: 'NYC',
},
userRegistrationRequired: true,
userRegistrationRequired: false,
visibleInSearch: true,
members: [
{
_id: 'john123',
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
},
{
_id: 'jane123',
firstName: 'Jane',
lastName: 'Doe',
email: '[email protected]',
},
],
admins: [
{
_id: 'john123',
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
createdAt: '12-03-2024',
},
'64378abd85008f171cf2990d',
'658930fd2caa9d8d6908745c',
'6589386a2caa9d8d69087484',
'6589387e2caa9d8d69087485',
'6589388b2caa9d8d69087486',
'6589389d2caa9d8d69087487',
'658938a62caa9d8d69087488',
'658938b02caa9d8d69087489',
'658938ba2caa9d8d6908748a',
],
admins: ['64378abd85008f171cf2990d'],
groupChats: [],
posts: [],
pinnedPosts: [],
membershipRequests: [],
blockedUsers: [],
creatorId: '64378abd85008f171cf2990d',
createdAt: '2023-04-13T05:16:52.827Z',
},
],
},
Expand All @@ -141,59 +130,47 @@ const MOCKS_WITH_IMAGE = [
{
request: {
query: ORGANIZATIONS_LIST_BY_CREATOR_ID,
variables: { id: '123' },
variables: { id: '64378abd85008f171cf2990d' },
},
result: {
data: {
organizations: [
{
_id: '123',
image:
'https://api.dicebear.com/5.x/initials/svg?seed=Test%20Organization',
creator: {
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
},
name: 'Test Organization',
description: 'Testing this organization',
_id: '6437904485008f171cf29924',
image: 'https://api.dicebear.com/5.x/initials/svg?seed=Unity%20Foundation', // Unity Foundation image
name: 'Unity Foundation',
description: 'A foundation aimed at uniting the world and making it a better place for all.',
address: {
city: 'Delhi',
countryCode: 'IN',
city: 'Bronx',
countryCode: 'US',
dependentLocality: 'Some Dependent Locality',
line1: '123 Random Street',
line2: 'Apartment 456',
postalCode: '110001',
postalCode: '10451',
sortingCode: 'ABC-123',
state: 'Delhi',
state: 'NYC',
},
userRegistrationRequired: true,
userRegistrationRequired: false,
visibleInSearch: true,
members: [
{
_id: 'john123',
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
},
{
_id: 'jane123',
firstName: 'Jane',
lastName: 'Doe',
email: '[email protected]',
},
],
admins: [
{
_id: 'john123',
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
createdAt: '12-03-2024',
},
'64378abd85008f171cf2990d',
'658930fd2caa9d8d6908745c',
'6589386a2caa9d8d69087484',
'6589387e2caa9d8d69087485',
'6589388b2caa9d8d69087486',
'6589389d2caa9d8d69087487',
'658938a62caa9d8d69087488',
'658938b02caa9d8d69087489',
'658938ba2caa9d8d6908748a',
],
admins: ['64378abd85008f171cf2990d'],
groupChats: [],
posts: [],
pinnedPosts: [],
membershipRequests: [],
blockedUsers: [],
creatorId: '64378abd85008f171cf2990d',
createdAt: '2023-04-13T05:16:52.827Z',
},
],
},
Expand All @@ -205,7 +182,7 @@ const MOCKS_EMPTY = [
{
request: {
query: ORGANIZATIONS_LIST_BY_CREATOR_ID,
variables: { id: '123' },
variables: { id: '64378abd85008f171cf2990d' },
},
result: {
data: {
Expand Down Expand Up @@ -326,7 +303,7 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => {
);
await wait();
userEvent.click(screen.getByText('Dashboard'));
expect(global.window.location.pathname).toContain('/orgdash/123');
expect(global.window.location.pathname).toContain('/orgdash/6437904485008f171cf29924');
});

test('Testing when screen size is less than 820px', async () => {
Expand All @@ -350,7 +327,7 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => {
const peopelBtn = screen.getByTestId(/People/i);
userEvent.click(peopelBtn);
await wait();
expect(window.location.pathname).toContain('/orgpeople/123');
expect(window.location.pathname).toContain('/orgpeople/6437904485008f171cf29924');
});

test('Testing when image is present for Organization', async () => {
Expand Down

0 comments on commit 04e782a

Please sign in to comment.