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

GrottoCenter / grottocenter-api / 19277458745

11 Nov 2025 08:15PM UTC coverage: 45.598% (+0.8%) from 44.806%
19277458745

push

github

Clément Ronzon
feat(region): adds endpoints for Region page support

963 of 2824 branches covered (34.1%)

Branch coverage included in aggregate %.

165 of 235 new or added lines in 15 files covered. (70.21%)

2 existing lines in 2 files now uncovered.

2958 of 5775 relevant lines covered (51.22%)

6.84 hits per line

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

75.0
/api/services/RegionService.js
1
const CommonService = require('./CommonService');
1✔
2

3
const NB_REGIONS_BY_COUNTRY = `
1✔
4
  SELECT COUNT(*)
5
  FROM (SELECT DISTINCT r.iso
6
        FROM t_iso3166_2 r
7
               JOIN t_entrance e ON e.iso_3166_2 = r.iso
8
        WHERE r.iso LIKE $1
9
          AND e.is_deleted = false) as tmp;
10
`;
11

12
module.exports = {
1✔
13
  /**
14
   *
15
   * @param {string} countryId alpha-2 code
16
   * @returns {int} the number of regions in the specified country
17
   *                or null if no result or something went wrong
18
   */
19
  getNbRegionsByCountry: async (countryId) => {
20
    try {
1✔
21
      const queryResult = await CommonService.query(NB_REGIONS_BY_COUNTRY, [
1✔
22
        `${countryId}-%`,
23
      ]);
24
      const result = queryResult.rows;
1✔
25
      if (result.length > 0) {
1!
26
        return result[0];
1✔
27
      }
NEW
28
      return null;
×
29
    } catch (e) {
NEW
30
      return null;
×
31
    }
32
  },
33
};
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

© 2026 Coveralls, Inc