1
0
mirror of https://github.com/badges/shields.git synced 2025-04-18 19:44:04 +03:00
shields/services/github/github-issues.tester.js
dependabot[bot] b9d96755ec
chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 (#9357)
* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* reformat all the things (prettier 3)

* update tests to await calls to prettier.format()

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
2023-07-10 09:27:51 +00:00

111 lines
3.0 KiB
JavaScript

import Joi from 'joi'
import { isMetric, isMetricOpenIssues } from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
t.create('GitHub closed pull requests')
.get('/issues-pr-closed/badges/shields.json')
.expectBadge({
label: 'pull requests',
message: Joi.string().regex(
/^([0-9]+[kMGTPEZY]?|[1-9]\.[1-9][kMGTPEZY]) closed$/,
),
})
t.create('GitHub closed pull requests raw')
.get('/issues-pr-closed-raw/badges/shields.json')
.expectBadge({
label: 'closed pull requests',
message: isMetric,
})
t.create('GitHub pull requests')
.get('/issues-pr/badges/shields.json')
.expectBadge({
label: 'pull requests',
message: isMetricOpenIssues,
})
t.create('GitHub pull requests raw')
.get('/issues-pr-raw/badges/shields.json')
.expectBadge({
label: 'open pull requests',
message: isMetric,
})
t.create('GitHub closed issues')
.get('/issues-closed/badges/shields.json')
.expectBadge({
label: 'issues',
message: Joi.string().regex(
/^([0-9]+[kMGTPEZY]?|[1-9]\.[1-9][kMGTPEZY]) closed$/,
),
})
t.create('GitHub closed issues raw')
.get('/issues-closed-raw/badges/shields.json')
.expectBadge({
label: 'closed issues',
message: isMetric,
})
t.create('GitHub open issues').get('/issues/badges/shields.json').expectBadge({
label: 'issues',
message: isMetricOpenIssues,
})
t.create('GitHub open issues raw')
.get('/issues-raw/badges/shields.json')
.expectBadge({ label: 'open issues', message: isMetric })
t.create('GitHub open issues by label is > zero')
.get('/issues/badges/shields/service-badge.json')
.expectBadge({
label: 'service-badge issues',
message: isMetricOpenIssues,
})
t.create('GitHub open issues by multi-word label is > zero')
.get('/issues/Cockatrice/Cockatrice/App%20-%20Cockatrice.json')
.expectBadge({
label: '"App - Cockatrice" issues',
message: isMetricOpenIssues,
})
t.create('GitHub open issues by label (raw)')
.get('/issues-raw/badges/shields/service-badge.json')
.expectBadge({
label: 'open service-badge issues',
message: isMetric,
})
// https://github.com/badges/shields/issues/1870
t.create('GitHub open issues by label including slash character (raw)')
.get('/issues-raw/calebcartwright/shields-service-test-target/@foo/bar.json')
.expectBadge({
label: 'open @foo/bar issues',
// Not always > 0.
message: Joi.alternatives(isMetric, Joi.equal('0')),
})
t.create('GitHub open issues (repo not found)')
.get('/issues-raw/badges/helmets.json')
.expectBadge({
label: 'issues',
message: 'repo not found',
})
t.create('GitHub open pull requests by label')
.get('/issues-pr/badges/shields/service-badge.json')
.expectBadge({
label: 'service-badge pull requests',
message: isMetricOpenIssues,
})
t.create('GitHub open pull requests by label (raw)')
.get('/issues-pr-raw/badges/shields/service-badge.json')
.expectBadge({
label: 'open service-badge pull requests',
message: isMetric,
})