How to use the @octokit/rest.search function in @octokit/rest

To help you get started, we’ve selected a few @octokit/rest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gatsbyjs / api.gatsbyjs.org / src / graphql / __tests__ / resolvers.js View on Github external
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' }]
            }
          ]
github gatsbyjs / api.gatsbyjs.org / src / graphql / __tests__ / resolvers.js View on Github external
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"/);
      });