-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle creating and using forks (#10)
- Loading branch information
1 parent
756db9d
commit efc9670
Showing
7 changed files
with
3,100 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const { test } = require('tap') | ||
|
||
const Octokit = require('@octokit/rest') | ||
.plugin(require('..')) | ||
|
||
test('create fork', async t => { | ||
const fixtures = require('./fixtures/create-fork') | ||
const octokit = new Octokit() | ||
|
||
octokit.hook.wrap('request', (_, options) => { | ||
const currentFixtures = fixtures.shift() | ||
const { baseUrl, method, url, request, headers, mediaType, ...params } = options | ||
|
||
t.equal(currentFixtures.request.method, options.method) | ||
t.equal(currentFixtures.request.url, options.url) | ||
|
||
Object.keys(params).forEach(paramName => { | ||
t.deepEqual(currentFixtures.request[paramName], params[paramName]) | ||
}) | ||
return currentFixtures.response | ||
}) | ||
|
||
await octokit.createPullRequest({ | ||
owner: 'gr2m', | ||
repo: 'pull-request-test', | ||
title: 'One comes, one goes', | ||
body: 'because', | ||
head: 'test-branch-u7es0', | ||
changes: { | ||
files: { | ||
'path/to/file1.txt': 'Content for file1', | ||
'path/to/file2.txt': 'Content for file2' | ||
}, | ||
commit: 'why' | ||
} | ||
}) | ||
|
||
t.equal(fixtures.length, 0) | ||
}) |
Oops, something went wrong.