• 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/asyncFunctionsPromises.ts
1
import request from "request";
2

3
/**
4
 *
5
 * @param location - Location to look for lat/long coordinates in mapbox API
6
 * @returns A promise, which in case it is resolved, provides a response from the Mapbox API
7
 */
8
export const coordinatesInfoPromises = (location: string) => {
2✔
9
  const url = `http://api.mapbox.com/search/geocode/v6/forward?q=${encodeURIComponent(location)}&access_token=pk.eyJ1IjoiZWR1c2VncmUiLCJhIjoiY21ueWhwNWZ5MDJkajJycjhuMmNldzJ2biJ9.qAOzQ8mbGd779n-Q1F8VaA&limit=1`;
4✔
10
  return new Promise<request.Response>((resolve, reject) => {
4✔
11
    request(
4✔
12
      { url: url, json: true },
13
      (error: Error, response: request.Response) => {
14
        if (error) {
4✔
15
          reject(error.message);
×
16
        } else if (response.body.features.length === 0) {
4✔
17
          reject("Mapbox API error: no location found");
2✔
18
        } else {
19
          resolve(response);
2✔
20
        }
21
      },
22
    );
23
  });
24
};
25

26
/**
27
 *
28
 * @param location - Lat/long coordinates to look for weather info in weatherstack API
29
 * @returns A promise, which in case it is resolved, provides a response from the weatherstack API
30
 */
31
export const weatherInfoPromises = (location: string) => {
2✔
UNCOV
32
  const url = `http://api.weatherstack.com/current?access_key=011788e829467ebe36dcca057b57bac4&query=${encodeURIComponent(location)}&units=m`;
×
UNCOV
33
  return new Promise<request.Response>((resolve, reject) => {
×
UNCOV
34
    request(
×
35
      { url: url, json: true },
36
      (error: Error, response: request.Response) => {
UNCOV
37
        if (error) {
×
38
          reject(error.message);
×
UNCOV
39
        } else if (response.body.error) {
×
UNCOV
40
          reject(response.body.error.type);
×
41
        } else {
UNCOV
42
          resolve(response);
×
43
        }
44
      },
45
    );
46
  });
47
};
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