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 { BaseOreService, description } from './ore-base.js' |
1✔ |
4 |
|
1✔ |
5 |
export default class OreStars extends BaseOreService { |
|
6 |
static category = 'rating' |
3✔ |
7 |
|
3✔ |
8 |
static route = {
|
3✔ |
9 |
base: 'ore/stars', |
3✔ |
10 |
pattern: ':pluginId', |
3✔ |
11 |
} |
3✔ |
12 |
|
3✔ |
13 |
static openApi = {
|
3✔ |
14 |
'/ore/stars/{pluginId}': {
|
3✔ |
15 |
get: {
|
3✔ |
16 |
summary: 'Ore Stars', |
3✔ |
17 |
description, |
3✔ |
18 |
parameters: pathParams({
|
3✔ |
19 |
name: 'pluginId', |
3✔ |
20 |
example: 'nucleus', |
3✔ |
21 |
}), |
3✔ |
22 |
}, |
3✔ |
23 |
}, |
× |
24 |
} |
× |
25 |
|
× |
26 |
static defaultBadgeData = {
|
× |
27 |
label: 'stars', |
3✔ |
28 |
color: 'blue', |
3✔ |
29 |
} |
× |
30 |
|
× |
31 |
static render({ stars }) {
|
|
32 |
return {
|
1✔ |
33 |
message: metric(stars),
|
1✔ |
34 |
} |
1✔ |
35 |
} |
1✔ |
36 |
|
3✔ |
37 |
async handle({ pluginId }) { |
|
38 |
const { stats } = await this.fetch({ pluginId })
|
2✔ |
39 |
const { stars } = stats |
|
40 |
return this.constructor.render({ stars }) |
1✔ |
41 |
} |
2✔ |
42 |
} |
3✔ |