mirror of
https://github.com/badges/shields.git
synced 2025-10-21 09:33:43 +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:
@@ -8,6 +8,41 @@ t.create('Last Commit (recent)').get('/gitea/tea.json').expectBadge({
|
||||
message: isFormattedDate,
|
||||
})
|
||||
|
||||
t.create('Last Commit (recent) (top-level file path)')
|
||||
.get('/gitea/tea.json?path=README.md')
|
||||
.expectBadge({
|
||||
label: 'last commit',
|
||||
message: isFormattedDate,
|
||||
})
|
||||
|
||||
t.create('Last Commit (recent) (top-level dir path)')
|
||||
.get('/gitea/tea.json?path=docs')
|
||||
.expectBadge({
|
||||
label: 'last commit',
|
||||
message: isFormattedDate,
|
||||
})
|
||||
|
||||
t.create('Last Commit (recent) (top-level dir path with trailing slash)')
|
||||
.get('/gitea/tea.json?path=docs/')
|
||||
.expectBadge({
|
||||
label: 'last commit',
|
||||
message: isFormattedDate,
|
||||
})
|
||||
|
||||
t.create('Last Commit (recent) (nested dir path)')
|
||||
.get('/gitea/tea.json?path=docs/CLI.md')
|
||||
.expectBadge({
|
||||
label: 'last commit',
|
||||
message: isFormattedDate,
|
||||
})
|
||||
|
||||
t.create('Last Commit (recent) (path)')
|
||||
.get('/gitea/tea.json?path=README.md')
|
||||
.expectBadge({
|
||||
label: 'last commit',
|
||||
message: isFormattedDate,
|
||||
})
|
||||
|
||||
t.create('Last Commit (recent) (self-managed)')
|
||||
.get('/CanisHelix/shields-badge-test.json?gitea_url=https://codeberg.org')
|
||||
.expectBadge({
|
||||
@@ -24,9 +59,23 @@ t.create('Last Commit (on-branch) (self-managed)')
|
||||
message: isFormattedDate,
|
||||
})
|
||||
|
||||
t.create('Last Commit (project not found)')
|
||||
t.create('Last Commit (user not found)')
|
||||
.get('/CanisHelix/does-not-exist.json?gitea_url=https://codeberg.org')
|
||||
.expectBadge({
|
||||
label: 'last commit',
|
||||
message: 'user or repo not found',
|
||||
message: 'user, repo or path not found',
|
||||
})
|
||||
|
||||
t.create('Last Commit (repo not found)')
|
||||
.get('/gitea/not-a-repo.json')
|
||||
.expectBadge({
|
||||
label: 'last commit',
|
||||
message: 'user, repo or path not found',
|
||||
})
|
||||
|
||||
t.create('Last Commit (path not found)')
|
||||
.get('/gitea/tea.json?path=not/a/dir')
|
||||
.expectBadge({
|
||||
label: 'last commit',
|
||||
message: 'user, repo or path not found',
|
||||
})
|
||||
|
Reference in New Issue
Block a user