Skip to content

Commit

Permalink
Merge pull request #4 from onrunning/B2C-8964-fix-exception-regex
Browse files Browse the repository at this point in the history
B2C-8964 - Fix exceptionRegex not tested against branch name
  • Loading branch information
pmrotule authored Jun 21, 2022
2 parents 7d79864 + e86af85 commit 000b679
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,9 @@ describe('#pull-request', () => {
beforeAll(async () => {
jest.resetModules()
jest.resetAllMocks()
ticket = 'A1C-1234'
preview = 'preview-123'
const options = {
branch: `${ticket}-some-feature`,
branch: 'dependabot/npm_and_yarn/swiper-8.2.4',
preview,
updateStatus: HTTP_STATUS_SUCCESS,
}
Expand All @@ -342,13 +341,10 @@ describe('#pull-request', () => {
expect(errorSpy).not.toHaveBeenCalled()
})

it('updates PR title and description', () => {
it('updates PR description with preview link only', () => {
expect(prUpdateSpy).toHaveBeenCalledWith({
...DEFAULT_REQUEST_OPTIONS,
title: `${ticket} - title`,
body:
`**[Preview](${preview})**\n` +
`**[Jira ticket](https://account.atlassian.net/browse/${ticket})**\n\nbody`,
body: `**[Preview](${preview})**\n\nbody`,
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async function run(): Promise<void> {

if (!ticketRegex.test(prTitle)) request.title = `${ticketInBranch} - ${prTitle}`
} else {
const isException = new RegExp(exceptionRegex, exceptionRegexFlags).test(ticketInBranch)
const isException = new RegExp(exceptionRegex, exceptionRegexFlags).test(headBranch)

if (!isException) {
const regexStr = ticketRegex.toString()
Expand Down

0 comments on commit 000b679

Please sign in to comment.