mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 22:07:09 +01:00
Fix badge encoding for values including the _ underscore character
This commit is contained in:
parent
6079ce3d17
commit
bed521d765
2 changed files with 11 additions and 1 deletions
|
|
@ -31,6 +31,16 @@ describe('getBadge', () => {
|
||||||
expect(badge).toBe('')
|
expect(badge).toBe('')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('handles badge title with multiple underscores', () => {
|
||||||
|
const options: ReportOptions = {
|
||||||
|
...DEFAULT_OPTIONS,
|
||||||
|
badgeTitle: 'my_integration_test'
|
||||||
|
}
|
||||||
|
const badge = getBadge(10, 0, 0, options)
|
||||||
|
// All underscores in the title should be encoded as __
|
||||||
|
expect(badge).toBe('')
|
||||||
|
})
|
||||||
|
|
||||||
it('handles badge title with version format containing hyphen', () => {
|
it('handles badge title with version format containing hyphen', () => {
|
||||||
const options: ReportOptions = {
|
const options: ReportOptions = {
|
||||||
...DEFAULT_OPTIONS,
|
...DEFAULT_OPTIONS,
|
||||||
|
|
|
||||||
|
|
@ -309,5 +309,5 @@ function getResultIcon(result: TestExecutionResult): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeImgShieldsURIComponent(component: string): string {
|
function encodeImgShieldsURIComponent(component: string): string {
|
||||||
return encodeURIComponent(component).replace(/-/g, '--')
|
return encodeURIComponent(component).replace(/-/g, '--').replace(/_/g, '__')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue