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
99d18d8
commit d3a7bf2
Showing
6 changed files
with
1,708 additions
and
52 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,7 @@ | ||
'use strict'; | ||
|
||
module.exports = (title) => | ||
title | ||
.trim() | ||
.replace(/[\s-]+\[?\s*(ONK-\d+)\s*]?\s*$/, ' $1') | ||
.replace(/^([A-Za-z]+)[/:]\s*/, (s, arg1) => `${arg1.toLowerCase()}: `); |
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,25 @@ | ||
'use strict'; | ||
|
||
const cleanTitle = require('./cleanTitle'); | ||
|
||
it('should clean dash before ONK', () => { | ||
expect(cleanTitle('feat: add something - ONK-1234')).toBe( | ||
'feat: add something ONK-1234' | ||
); | ||
}); | ||
|
||
it('should clean space before ONK', () => { | ||
expect(cleanTitle('feat: add something ONK-1234')).toBe( | ||
'feat: add something ONK-1234' | ||
); | ||
}); | ||
|
||
it('should clean dash and space before ONK', () => { | ||
expect(cleanTitle('feat: add something - ONK-1234')).toBe( | ||
'feat: add something ONK-1234' | ||
); | ||
}); | ||
|
||
it('should clean uppercase and slash', () => { | ||
expect(cleanTitle('Feat/add something')).toBe('feat: add something'); | ||
}); |
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
Oops, something went wrong.