-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdca4f4
commit f226d2b
Showing
10 changed files
with
5,407 additions
and
7,429 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
// Import the default config file and expose it in the project root. | ||
// Useful for editor integrations. | ||
module.exports = require( '@wordpress/prettier-config' ); |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const runner = require('./runner'); | ||
const runner = require( './runner' ); | ||
|
||
module.exports = { | ||
name: 'assign-milestone', | ||
events: ['pull_request_review'], | ||
actions: ['submitted', 'edited'], | ||
events: [ 'pull_request_review' ], | ||
actions: [ 'submitted', 'edited' ], | ||
runner, | ||
}; |
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
42 changes: 21 additions & 21 deletions
42
lib/automations/assign-milestone/test/pull-request-review-handler.js
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 |
---|---|---|
@@ -1,32 +1,32 @@ | ||
const { gimmeOctokit, gimmeContext, gimmeApp } = require('@testHelpers'); | ||
const { gimmeOctokit, gimmeContext, gimmeApp } = require( '@testHelpers' ); | ||
|
||
describe('pull-request-review-handler assigns milestones to pull requests', () => { | ||
describe( 'pull-request-review-handler assigns milestones to pull requests', () => { | ||
let octokit, context, app; | ||
beforeEach(() => { | ||
beforeEach( () => { | ||
octokit = gimmeOctokit(); | ||
context = gimmeContext('pull_request_review', 'submitted'); | ||
app = gimmeApp('assign-milestone'); | ||
}); | ||
it('does nothing if the pull request is not approved', async () => { | ||
context = gimmeContext( 'pull_request_review', 'submitted' ); | ||
app = gimmeApp( 'assign-milestone' ); | ||
} ); | ||
it( 'does nothing if the pull request is not approved', async () => { | ||
context.payload = { | ||
...context.payload, | ||
review: { state: 'comment' }, | ||
}; | ||
await app(context, octokit); | ||
expect(octokit.issues.update).not.toHaveBeenCalled(); | ||
}); | ||
it('does nothing if the pull request has a milestone', async () => { | ||
await app( context, octokit ); | ||
expect( octokit.issues.update ).not.toHaveBeenCalled(); | ||
} ); | ||
it( 'does nothing if the pull request has a milestone', async () => { | ||
context.payload = { | ||
...context.payload, | ||
pull_request: { milestone: { number: 1 } }, | ||
}; | ||
await app(context, octokit); | ||
expect(octokit.issues.update).not.toHaveBeenCalled(); | ||
}); | ||
it('assigns a milestone to an approved pull request', async () => { | ||
await app(context, octokit); | ||
expect(octokit.issues.listMilestones).toHaveBeenCalled(); | ||
expect(octokit.issues.update).toHaveBeenCalled(); | ||
expect(octokit.issues.update.mock.calls[0]).toMatchSnapshot(); | ||
}); | ||
}); | ||
await app( context, octokit ); | ||
expect( octokit.issues.update ).not.toHaveBeenCalled(); | ||
} ); | ||
it( 'assigns a milestone to an approved pull request', async () => { | ||
await app( context, octokit ); | ||
expect( octokit.issues.listMilestones ).toHaveBeenCalled(); | ||
expect( octokit.issues.update ).toHaveBeenCalled(); | ||
expect( octokit.issues.update.mock.calls[ 0 ] ).toMatchSnapshot(); | ||
} ); | ||
} ); |
Oops, something went wrong.