forked from amannn/action-semantic-pull-request
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
5 changed files
with
51 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module.exports = (subjectPatternError, subject, title) => | ||
subjectPatternError.replace('${subject}', subject).replace('${title}', title); |
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,24 @@ | ||
const subjectPatternErrorParser = require('./SubjectPatternErrorParser'); | ||
|
||
describe('parse pattern error', () => { | ||
it('parse string without changes if template values not provided', () => { | ||
const customError = 'this is test'; | ||
expect(subjectPatternErrorParser(customError)).toEqual(customError); | ||
}); | ||
|
||
it('parses string properly by replacing one template value', () => { | ||
expect( | ||
subjectPatternErrorParser('this is ${subject} test', 'my subject') | ||
).toEqual('this is my subject test'); | ||
}); | ||
|
||
it('parses string properly by replacing both template values', () => { | ||
expect( | ||
subjectPatternErrorParser( | ||
'this ${title} is ${subject} test', | ||
'my subject', | ||
'my title' | ||
) | ||
).toEqual('this my title is my subject test'); | ||
}); | ||
}); |
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