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

badges / shields / 18772560856

22 Oct 2025 10:00PM UTC coverage: 98.011% (+0.007%) from 98.004%
18772560856

push

github

web-flow
Stop depending on lodash groupby, difference and times (#11428)

5956 of 6228 branches covered (95.63%)

8 of 8 new or added lines in 1 file covered. (100.0%)

9 existing lines in 1 file now uncovered.

50127 of 51144 relevant lines covered (98.01%)

132.0 hits per line

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

86.57
/services/nostr-band/nostr-band-followers.service.js
1
import Joi from 'joi'
3✔
2
import { metric } from '../text-formatters.js'
3✔
3
import { BaseJsonService, pathParams } from '../index.js'
3✔
4

3✔
5
const npubSchema = Joi.object({
3✔
6
  followers_pubkey_count: Joi.number().required(),
3✔
7
}).required()
3✔
8

3✔
9
const mainSchema = Joi.object({
3✔
10
  stats: Joi.object()
3✔
11
    .pattern(Joi.string(), npubSchema)
3✔
12
    .min(1)
3✔
13
    .max(1)
3✔
14
    .required(),
3✔
15
}).required()
3✔
16

3✔
17
export default class NostrBandFollowers extends BaseJsonService {
3✔
18
  static category = 'social'
3✔
19

3✔
20
  static route = {
3✔
21
    base: 'nostr-band/followers',
3✔
22
    pattern: ':npub',
3✔
23
  }
3✔
24

3✔
25
  static openApi = {
3✔
26
    '/nostr-band/followers/{npub}': {
3✔
27
      get: {
3✔
28
        summary: 'Nostr.band Followers',
3✔
29
        description:
3✔
30
          'Returns the number of followers for a Nostr pubkey using the Nostr.band API.',
3✔
31
        parameters: pathParams({
3✔
32
          name: 'npub',
3✔
33
          description: 'Nostr pubkey in (npub1...) format or hex.',
3✔
34
          example:
3✔
35
            'npub18c556t7n8xa3df2q82rwxejfglw5przds7sqvefylzjh8tjne28qld0we7',
3✔
36
        }),
3✔
37
      },
3✔
38
    },
3✔
39
  }
3✔
40

3✔
41
  static defaultBadgeData = { label: 'followers' }
3✔
42

3✔
43
  static render({ followers }) {
3✔
UNCOV
44
    return {
×
UNCOV
45
      message: metric(followers),
×
UNCOV
46
      style: 'social',
×
UNCOV
47
    }
×
UNCOV
48
  }
×
49

3✔
50
  async fetch({ npub }) {
3✔
51
    const data = await this._requestJson({
8✔
52
      url: `https://api.nostr.band/v0/stats/profile/${npub}`,
8✔
53
      schema: mainSchema,
8✔
54
      httpErrors: {
8✔
55
        400: 'invalid pubkey',
8✔
56
      },
8✔
57
    })
8✔
UNCOV
58
    const stats = data.stats
×
UNCOV
59
    const firstKey = Object.keys(stats)[0]
×
UNCOV
60
    return stats[firstKey].followers_pubkey_count
×
61
  }
8✔
62

3✔
63
  async handle({ npub }) {
3✔
64
    const followers = await this.fetch({ npub })
8✔
UNCOV
65
    return this.constructor.render({ followers })
×
66
  }
8✔
67
}
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc