push
github
6368 of 6617 branches covered (96.24%)
47551 of 49487 relevant lines covered (96.09%)
121.28 hits per line
1 |
import { pathParams } from '../index.js' |
|
2 |
import { metric } from '../text-formatters.js' |
1✔ |
3 |
import { BaseHangarService, description } from './hangar-base.js' |
1✔ |
4 |
|
1✔ |
5 |
export default class HangarWatchers extends BaseHangarService { |
|
6 |
static category = 'social' |
3✔ |
7 |
|
3✔ |
8 |
static route = {
|
3✔ |
9 |
base: 'hangar/watchers', |
3✔ |
10 |
pattern: ':slug', |
3✔ |
11 |
} |
3✔ |
12 |
|
3✔ |
13 |
static openApi = {
|
3✔ |
14 |
'/hangar/watchers/{slug}': {
|
3✔ |
15 |
get: {
|
3✔ |
16 |
summary: 'Hangar Watchers', |
3✔ |
17 |
description, |
3✔ |
18 |
parameters: pathParams({
|
3✔ |
19 |
name: 'slug', |
3✔ |
20 |
example: 'Essentials', |
3✔ |
21 |
}), |
3✔ |
22 |
}, |
× |
23 |
}, |
× |
24 |
} |
× |
25 |
|
× |
26 |
static defaultBadgeData = {
|
× |
27 |
label: 'watchers', |
3✔ |
28 |
color: 'blue', |
3✔ |
29 |
} |
3✔ |
30 |
|
3✔ |
31 |
static render({ watchers }) {
|
|
32 |
return {
|
1✔ |
33 |
message: metric(watchers),
|
1✔ |
34 |
} |
1✔ |
35 |
} |
1✔ |
36 |
|
3✔ |
37 |
async handle({ slug }) { |
|
38 |
const { |
2✔ |
39 |
stats: { watchers },
|
2✔ |
40 |
} = await this.fetch({ slug })
|
2✔ |
41 |
return this.constructor.render({ watchers }) |
|
42 |
} |
2✔ |
43 |
} |
3✔ |