Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('returns pull request information for a contributor', async () => {
gh.search.issues.mockResolvedValueOnce(mockGitHubIssueSearchResult);
const result = await resolvers.Query.contributorInformation(null, {
githubUsername: 'gatsbot'
});
expect(result).toEqual({
totalContributions: 1,
pullRequests: [
{
id: 1,
title: 'test issue',
url: 'https://github.com/gatsbyjs/gatsby/issues/1',
number: 1,
labels: [{ name: 'test label', url: 'https://example.org' }]
}
]
test('adds the appropriate tags for a second-level contributor', async () => {
prisma.contributor.mockResolvedValueOnce(mockPrismaContributor);
gh.search.issues.mockResolvedValueOnce({
data: {
...mockGitHubIssueSearchResult.data,
total_count: 5
}
});
axios.mockResolvedValueOnce(mockShopifyAddTagsSuccess);
await resolvers.Mutation.updateContributorTags(null, {
githubUsername: 'gatsbot'
});
const mutation = axios.mock.calls[0][0].data;
expect(mutation).toMatch(/"contributor","level2"/);
});