Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions __tests__/schema/opportunity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,68 @@ describe('query userOpportunityMatches', () => {
period: 1, // ANNUAL
});
});

it('should include opportunity details when requested', async () => {
loggedUser = '1';

const GET_USER_MATCHES_WITH_OPPORTUNITY_QUERY = /* GraphQL */ `
query GetUserOpportunityMatchesWithOpportunity($first: Int) {
userOpportunityMatches(first: $first) {
edges {
node {
userId
opportunityId
status
updatedAt
opportunity {
id
title
state
location {
city
country
}
organization {
id
name
}
}
}
}
}
}
`;

const res = await client.query(GET_USER_MATCHES_WITH_OPPORTUNITY_QUERY, {
variables: {
first: 10,
},
});

expect(res.errors).toBeFalsy();
expect(res.data.userOpportunityMatches.edges).toHaveLength(2);

const matchWithOpportunity = res.data.userOpportunityMatches.edges.find(
(e: { node: { opportunityId: string } }) =>
e.node.opportunityId === '550e8400-e29b-41d4-a716-446655440001',
);

expect(matchWithOpportunity.node.opportunity).toEqual({
id: '550e8400-e29b-41d4-a716-446655440001',
title: 'Senior Full Stack Developer',
state: 2, // LIVE
location: [
{
city: null,
country: 'Norway',
},
],
organization: {
id: '550e8400-e29b-41d4-a716-446655440000',
name: 'Daily Dev Inc',
},
});
});
});

describe('query getCandidatePreferences', () => {
Expand Down
1 change: 1 addition & 0 deletions src/schema/opportunity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export const typeDefs = /* GraphQL */ `
createdAt: DateTime!
updatedAt: DateTime!
user: User!
opportunity: Opportunity
candidatePreferences: UserCandidatePreference
screening: [ScreeningAnswer!]!
feedback: [ScreeningAnswer!]!
Expand Down
Loading