Skip to content

Commit

Permalink
added test for eventstats and eventattendance
Browse files Browse the repository at this point in the history
  • Loading branch information
duplixx committed Nov 9, 2024
1 parent 93fdbfb commit f36d7fc
Show file tree
Hide file tree
Showing 8 changed files with 498 additions and 554 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 4 additions & 32 deletions src/GraphQl/Queries/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,6 @@ export const EVENT_ATTENDEES = gql`
eventsAttended {
_id
}
tagsAssignedWith {
edges {
node {
name
_id
}
}
}
}
}
}
Expand Down Expand Up @@ -428,13 +420,7 @@ export const ORGANIZATIONS_LIST = gql`

// Query to take the Members of a particular organization
export const MEMBERS_LIST = gql`
query Organizations(
$id: ID!
$after: String
$before: String
$first: Int
$last: Int
) {
query Organizations($id: ID!) {
organizations(id: $id) {
_id
members {
Expand All @@ -444,20 +430,8 @@ export const MEMBERS_LIST = gql`
image
email
createdAt
gender
tagsAssignedWith(
after: $after
before: $before
first: $first
last: $last
organizationId: $id
) {
edges {
cursor
node {
name
}
}
organizationsBlockedBy {
_id
}
}
}
Expand Down Expand Up @@ -622,15 +596,13 @@ export const ORGANIZATION_EVENT_CONNECTION_LIST = gql`
$location_contains: String
$first: Int
$skip: Int
$id_starts_with: ID
) {
eventsByOrganizationConnection(
where: {
organization_id: $organization_id
title_contains: $title_contains
description_contains: $description_contains
location_contains: $location_contains
id_starts_with: $id_starts_with
}
first: $first
skip: $skip
Expand Down Expand Up @@ -886,4 +858,4 @@ export {
USER_CREATED_ORGANIZATIONS,
USER_JOINED_ORGANIZATIONS,
USER_ORGANIZATION_CONNECTION,
} from './OrganizationQueries';
} from './OrganizationQueries';
62 changes: 62 additions & 0 deletions src/components/EventManagement/EventAttendance/Attendance.mocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { EVENT_ATTENDEES } from 'GraphQl/Queries/Queries';

export const MOCKS = [
{
request: {
query: EVENT_ATTENDEES,
variables: {}, // Removed id since it's not required based on error
},
result: {
data: {
event: {
attendees: [
{
_id: '6589386a2caa9d8d69087484',
firstName: 'Bruce',
lastName: 'Garza',
gender: null,
birthDate: null,
createdAt: '2023-04-13T10:23:17.742',
eventsAttended: [
{
__typename: 'Event',
_id: '660fdf7d2c1ef6c7db1649ad',
},
{
__typename: 'Event',
_id: '660fdd562c1ef6c7db1644f7',
},
],
__typename: 'User',
},
{
_id: '6589386a2caa9d8d69087485',
firstName: 'Jane',
lastName: 'Smith',
gender: null,
birthDate: null,
createdAt: '2023-04-13T10:23:17.742',
eventsAttended: [
{
__typename: 'Event',
_id: '660fdf7d2c1ef6c7db1649ad',
},
],
__typename: 'User',
},
],
},
},
},
},
];

export const MOCKS_ERROR = [
{
request: {
query: EVENT_ATTENDEES,
variables: {},
},
error: new Error('An error occurred'),
},
];
Loading

0 comments on commit f36d7fc

Please sign in to comment.