mirror of
https://github.com/badges/shields.git
synced 2025-07-05 13:41:14 +03:00
[GithubLastCommit] [GitlabLastCommit] [GiteaLastCommit] Support file path for last commit (#10041)
* Support file path for GitHub last commit * Support file path for GitLab last commit * Support file path for Gitea last commit * Define common `relativeUri` validator * Sort imports * Add more tests for path variations * Fix test name Co-authored-by: chris48s <chris48s@users.noreply.github.com> * Update Gitea 404 message * Handle case when no commits are returned for GitHub and GitLab --------- Co-authored-by: chris48s <chris48s@users.noreply.github.com>
This commit is contained in:
@ -14,6 +14,26 @@ t.create('last commit (on branch)')
|
||||
.get('/badges/badgr.co/shielded.json')
|
||||
.expectBadge({ label: 'last commit', message: 'july 2013' })
|
||||
|
||||
t.create('last commit (by top-level file path)')
|
||||
.get('/badges/badgr.co.json?path=README.md')
|
||||
.expectBadge({ label: 'last commit', message: 'september 2013' })
|
||||
|
||||
t.create('last commit (by top-level dir path)')
|
||||
.get('/badges/badgr.co.json?path=badgr')
|
||||
.expectBadge({ label: 'last commit', message: 'june 2013' })
|
||||
|
||||
t.create('last commit (by top-level dir path with trailing slash)')
|
||||
.get('/badges/badgr.co.json?path=badgr/')
|
||||
.expectBadge({ label: 'last commit', message: 'june 2013' })
|
||||
|
||||
t.create('last commit (by nested file path)')
|
||||
.get('/badges/badgr.co.json?path=badgr/colors.py')
|
||||
.expectBadge({ label: 'last commit', message: 'june 2013' })
|
||||
|
||||
t.create('last commit (on branch) (by top-level file path)')
|
||||
.get('/badges/badgr.co/shielded.json?path=README.md')
|
||||
.expectBadge({ label: 'last commit', message: 'june 2013' })
|
||||
|
||||
t.create('last commit (by committer)')
|
||||
.get('/badges/badgr.co/shielded.json?display_timestamp=committer')
|
||||
.expectBadge({ label: 'last commit', message: 'july 2013' })
|
||||
@ -21,3 +41,7 @@ t.create('last commit (by committer)')
|
||||
t.create('last commit (repo not found)')
|
||||
.get('/badges/helmets.json')
|
||||
.expectBadge({ label: 'last commit', message: 'repo not found' })
|
||||
|
||||
t.create('last commit (no commits found)')
|
||||
.get('/badges/badgr.co/shielded.json?path=not/a/dir')
|
||||
.expectBadge({ label: 'last commit', message: 'no commits found' })
|
||||
|
Reference in New Issue
Block a user