How to use the @octokit/rest.mockImplementationOnce 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 algolia / shipjs / packages / shipjs / src / step / prepare / __tests__ / createPullRequest.spec.js View on Github external
it('returns pr url', async () => {
    const create = jest.fn().mockImplementationOnce(() => ({
      data: { number: 13, html_url: 'https://github.com/my/repo/pull/13' }, // eslint-disable-line camelcase
    }));
    Octokit.mockImplementationOnce(function() {
      this.pulls = { create, createReviewRequest: jest.fn() };
    });
    const { pullRequestUrl } = await createPullRequest(getDefaultParams());
    expect(pullRequestUrl).toEqual('https://github.com/my/repo/pull/13');
  });