• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

badges / shields / 45774165149

22 Nov 2026 09:43PM UTC coverage: 79.735% (-18.4%) from 98.17%
45774165149

push

github

web-flow
[Endpoint] Support message override and position it after label in API docs (#12235)

* [Endpoint] Support message override and position it after label in API docs

* Preserve error message when a message override is provided

3371 of 3616 branches covered (93.22%)

43 of 53 new or added lines in 3 files covered. (81.13%)

9589 existing lines in 490 files now uncovered.

41514 of 52065 relevant lines covered (79.73%)

51.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.18
/services/github/github-release-date.service.js
1
import Joi from 'joi'
2 ✔
2
import { pathParam, queryParam } from '../index.js'
2 ✔
3
import { renderDateBadge } from '../date.js'
2 ✔
4
import { GithubAuthV3Service } from './github-auth-service.js'
2 ✔
5
import { documentation, httpErrorsFor } from './github-helpers.js'
2 ✔
6

2 ✔
7
const schema = Joi.alternatives(
2 ✔
8
  Joi.object({
2 ✔
9
    created_at: Joi.date().required(),
2 ✔
10
    published_at: Joi.date().required(),
2 ✔
11
  }).required(),
2 ✔
12
  Joi.array()
2 ✔
13
    .items(
2 ✔
14
      Joi.object({
2 ✔
15
        created_at: Joi.date().required(),
2 ✔
16
        published_at: Joi.date().required(),
2 ✔
17
      }).required(),
2 ✔
18
    )
2 ✔
19
    .min(1),
2 ✔
20
)
2 ✔
21

2 ✔
22
const displayDateEnum = ['created_at', 'published_at']
2 ✔
23

2 ✔
24
const queryParamSchema = Joi.object({
2 ✔
25
  display_date: Joi.string()
2 ✔
26
    .valid(...displayDateEnum)
2 ✔
27
    .default('published_at'),
2 ✔
28
}).required()
2 ✔
29

2 ✔
30
export default class GithubReleaseDate extends GithubAuthV3Service {
2 ✔
31
  static category = 'activity'
2 ✔
32
  static route = {
2 ✔
33
    base: 'github',
2 ✔
34
    pattern: ':variant/:user/:repo',
2 ✔
35
    queryParamSchema,
2 ✔
36
  }
2 ✔
37

2 ✔
38
  static routeEnum = ['release-date', 'release-date-pre']
2 ✔
39

2 ✔
40
  static openApi = {
2 ✔
41
    '/github/{variant}/{user}/{repo}': {
2 ✔
42
      get: {
2 ✔
43
        summary: 'GitHub Release Date',
2 ✔
44
        description: documentation,
2 ✔
45
        parameters: [
2 ✔
46
          pathParam({
2 ✔
47
            name: 'variant',
2 ✔
48
            example: 'release-date',
2 ✔
49
            schema: { type: 'string', enum: this.getEnum('variant') },
2 ✔
50
          }),
2 ✔
51
          pathParam({ name: 'user', example: 'SubtitleEdit' }),
2 ✔
52
          pathParam({ name: 'repo', example: 'subtitleedit' }),
2 ✔
53
          queryParam({
2 ✔
54
            name: 'display_date',
2 ✔
55
            example: 'published_at',
2 ✔
56
            schema: { type: 'string', enum: displayDateEnum },
2 ✔
57
            description: 'Default value is `created_at` if not specified',
2 ✔
58
          }),
2 ✔
59
        ],
2 ✔
60
      },
2 ✔
61
    },
2 ✔
62
  }
2 ✔
63

2 ✔
64
  static defaultBadgeData = { label: 'release date' }
2 ✔
65

2 ✔
66
  async fetch({ variant, user, repo }) {
2 ✔
UNCOV
67
    const url =
×
UNCOV
68
      variant === 'release-date'
×
UNCOV
69
        ? `/repos/${user}/${repo}/releases/latest`
×
UNCOV
70
        : `/repos/${user}/${repo}/releases`
×
UNCOV
71
    return this._requestJson({
×
UNCOV
72
      url,
×
UNCOV
73
      schema,
×
UNCOV
74
      httpErrors: httpErrorsFor('no releases or repo not found'),
×
UNCOV
75
    })
×
UNCOV
76
  }
×
77

2 ✔
78
  async handle({ variant, user, repo }, queryParams) {
2 ✔
UNCOV
79
    const body = await this.fetch({ variant, user, repo })
×
UNCOV
80
    if (Array.isArray(body)) {
×
UNCOV
81
      return renderDateBadge(body[0][queryParams.display_date])
×
UNCOV
82
    }
×
UNCOV
83
    return renderDateBadge(body[queryParams.display_date])
×
UNCOV
84
  }
×
85
}
2 ✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc