How to use the github/.constructor function in github

To help you get started, we’ve selected a few github 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 backstrokeapp / server / test / controllers / webhookOld.spec.js View on Github external
repo: 'fork0',
        state: 'open',
        head: 'upstreamuser:master',
      }).resolves([]);

      // Make the pull request
      ghMock.expects('pullRequestsCreate').withArgs({
        owner: 'forkuser', repo: 'fork0',
        title: 'Update from upstream repo upstreamuser/repo',
        head: 'upstreamuser:master',
        base: 'master',
        body: generateUpdateBody('upstreamuser/repo'),
        maintainer_can_modify: false,
      }).rejects(new Error('Explosion in the starboard engine room!'));

      ghOriginal.constructor = () => gh

      // inject the above mock
      let {default: webhook} = proxyquire("controllers/webhookOld", {'../github': ghOriginal});

      let req = {
        body: {
          repository: {
            full_name: 'forkuser/fork0',
            owner: {
              login: 'forkuser',
            },
            name: 'fork0',
            fork: true,
          },
        },
        query: {},