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

ULL-ESIT-INF-DSI-2526 / async-testing-vitest / 24394703096

14 Apr 2026 10:44AM UTC coverage: 50.0% (-11.9%) from 61.905%
24394703096

push

github

esegredo
fix: update Mapbox API access token in asyncFunctions and asyncFunctionsPromises

4 of 8 branches covered (50.0%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 2 files covered. (100.0%)

9 existing lines in 2 files now uncovered.

17 of 34 relevant lines covered (50.0%)

1.18 hits per line

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

50.0
/src/asyncFunctions.ts
1
import request from "request";
2

3
/**
4
 *
5
 * @param location - Location to look for lat/long coordinates in mapbox API
6
 * @param callback - Handler to manage the potential response from mapbox API
7
 */
8
export const coordinatesInfo = (
1✔
9
  location: string,
10
  callback: (
11
    err: string | undefined,
12
    data: request.Response | undefined,
13
  ) => void,
14
) => {
15
  const url = `http://api.mapbox.com/search/geocode/v6/forward?q=${encodeURIComponent(location)}&access_token=pk.eyJ1IjoiZWR1c2VncmUiLCJhIjoiY21ueWhwNWZ5MDJkajJycjhuMmNldzJ2biJ9.qAOzQ8mbGd779n-Q1F8VaA&limit=1`;
2✔
16

17
  request({ url: url, json: true }, (error: Error, response) => {
2✔
18
    if (error) {
2✔
19
      callback(`Mapbox API is not available: ${error.message}`, undefined);
×
20
    } else if (response.body.features.length === 0) {
2✔
21
      callback(`Mapbox API error: no location found`, undefined);
1✔
22
    } else {
23
      callback(undefined, response);
1✔
24
    }
25
  });
26
};
27

28
/**
29
 *
30
 * @param location - Lat/long coordinates to look for weather info
31
 * @param callback - Handler to manage the potential response from weatherstack API
32
 */
33
export const weatherInfo = (
1✔
34
  location: string,
35
  callback: (
36
    err: string | undefined,
37
    data: request.Response | undefined,
38
  ) => void,
39
) => {
UNCOV
40
  const url = `http://api.weatherstack.com/current?access_key=011788e829467ebe36dcca057b57bac4&query=${encodeURIComponent(location)}&units=m`;
×
41

UNCOV
42
  request({ url: url, json: true }, (error: Error, response) => {
×
43
    if (error) {
×
44
      callback(
×
45
        `Weatherstack API is not available: ${error.message}`,
46
        undefined,
47
      );
48
    } else if (response.body.error) {
×
49
      callback(
×
50
        `Weatherstack API error: ${response.body.error.type}`,
51
        undefined,
52
      );
53
    } else {
54
      callback(undefined, response);
×
55
    }
56
  });
57
};
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