Skip to content

Commit

Permalink
Merge branch 'badges:master' into feat/9493/improve-auth-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jNullj authored Feb 17, 2024
2 parents 1b79b4c + ed1d03f commit 419bd01
Show file tree
Hide file tree
Showing 26 changed files with 466 additions and 560 deletions.
6 changes: 3 additions & 3 deletions .github/actions/docusaurus-swizzled-warning/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 64 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"url": "https://github.com/badges/shields"
},
"dependencies": {
"@renovatebot/pep440": "^3.0.17",
"@renovatebot/pep440": "^3.0.19",
"@renovatebot/ruby-semver": "^3.0.23",
"@sentry/node": "^7.100.1",
"@sentry/node": "^7.101.1",
"@shields_io/camp": "^18.1.2",
"@xmldom/xmldom": "0.8.10",
"badge-maker": "file:badge-maker",
Expand Down Expand Up @@ -63,7 +63,7 @@
"qs": "^6.11.2",
"query-string": "^8.2.0",
"semver": "~7.6.0",
"simple-icons": "11.3.0",
"simple-icons": "11.4.0",
"smol-toml": "1.1.4",
"webextension-store-meta": "^1.0.5",
"xpath": "~0.0.34"
Expand Down Expand Up @@ -147,7 +147,7 @@
"@docusaurus/core": "^2.4.3",
"@easyops-cn/docusaurus-search-local": "^0.40.1",
"@mdx-js/react": "^1.6.21",
"@typescript-eslint/parser": "^6.21.0",
"@typescript-eslint/parser": "^7.0.1",
"c8": "^9.1.0",
"caller": "^1.1.0",
"chai": "^4.4.1",
Expand All @@ -172,7 +172,7 @@
"eslint-plugin-icedfrisby": "^0.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.0.6",
"eslint-plugin-mocha": "^10.2.0",
"eslint-plugin-mocha": "^10.3.0",
"eslint-plugin-no-extension-in-require": "^0.2.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "6.1.1",
Expand Down
31 changes: 21 additions & 10 deletions services/bitbucket/bitbucket-issues.service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Joi from 'joi'
import { metric } from '../text-formatters.js'
import { nonNegativeInteger } from '../validators.js'
import { BaseJsonService } from '../index.js'
import { BaseJsonService, pathParams } from '../index.js'

const bitbucketIssuesSchema = Joi.object({
size: nonNegativeInteger,
Expand All @@ -10,22 +10,33 @@ const bitbucketIssuesSchema = Joi.object({
function issueClassGenerator(raw) {
const routePrefix = raw ? 'issues-raw' : 'issues'
const badgeSuffix = raw ? '' : ' open'
const titleSuffix = raw ? ' (raw)' : ''

return class BitbucketIssues extends BaseJsonService {
static name = `BitbucketIssues${raw ? 'Raw' : ''}`
static category = 'issue-tracking'
static route = { base: `bitbucket/${routePrefix}`, pattern: ':user/:repo' }

static examples = [
{
title: 'Bitbucket open issues',
namedParams: {
user: 'atlassian',
repo: 'python-bitbucket',
static get openApi() {
const key = `/bitbucket/${routePrefix}/{user}/{repo}`
const route = {}
route[key] = {
get: {
summary: `Bitbucket open issues ${titleSuffix}`,
parameters: pathParams(
{
name: 'user',
example: 'shields-io',
},
{
name: 'repo',
example: 'test-repo',
},
),
},
staticPreview: this.render({ issues: 33 }),
},
]
}
return route
}

static defaultBadgeData = { label: 'issues' }

Expand Down
8 changes: 4 additions & 4 deletions services/bitbucket/bitbucket-issues.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ export const t = new ServiceTester({
})

t.create('issues-raw (valid)')
.get('/issues-raw/atlassian/python-bitbucket.json')
.get('/issues-raw/shields-io/test-repo.json')
.expectBadge({
label: 'issues',
message: isMetric,
})

t.create('issues-raw (not found)')
.get('/issues-raw/atlassian/not-a-repo.json')
.get('/issues-raw/shields-io/not-a-repo.json')
.expectBadge({ label: 'issues', message: 'not found' })

t.create('issues-raw (private repo)')
.get('/issues-raw/chris48s/example-private-repo.json')
.expectBadge({ label: 'issues', message: 'private repo' })

t.create('issues (valid)')
.get('/issues/atlassian/python-bitbucket.json')
.get('/issues/shields-io/test-repo.json')
.expectBadge({
label: 'issues',
message: isMetricOpenIssues,
})

t.create('issues (not found)')
.get('/issues/atlassian/not-a-repo.json')
.get('/issues/shields-io/not-a-repo.json')
.expectBadge({ label: 'issues', message: 'not found' })

t.create('issues (private repo)')
Expand Down
Loading

0 comments on commit 419bd01

Please sign in to comment.