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

thoughtspot / visual-embed-sdk / #1394

13 Jan 2025 10:10AM UTC coverage: 47.499% (-46.4%) from 93.86%
#1394

Pull #65

Prashant.patil
SCAL-233454-exp adding index.mobil.ts
Pull Request #65: test-exported memb

337 of 1108 branches covered (30.42%)

Branch coverage included in aggregate %.

80 of 342 new or added lines in 11 files covered. (23.39%)

872 existing lines in 20 files now uncovered.

1448 of 2650 relevant lines covered (54.64%)

9.46 hits per line

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

36.36
/src/utils/authService/tokenizedAuthService.ts
1
import { tokenizedFetch } from '../../tokenizedFetch';
19✔
2
import { logger } from '../logger';
19✔
3
import { EndPoints } from './authService';
19✔
4

5
/**
6
 *
7
 * @param url
8
 * @param options
9
 */
10
function tokenizedFailureLoggedFetch(url: string, options: RequestInit = {}): Promise<Response> {
×
UNCOV
11
    return tokenizedFetch(url, options).then(async (r) => {
×
UNCOV
12
        if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
×
UNCOV
13
            logger.error(`Failed to fetch ${url}`, await r.text?.());
×
14
        }
UNCOV
15
        return r;
×
16
    });
17
}
18

19
/**
20
 * Fetches the session info from the ThoughtSpot server.
21
 * @param thoughtspotHost
22
 * @returns {Promise<any>}
23
 * @example
24
 * ```js
25
 *  const response = await sessionInfoService();
26
 * ```
27
 */
28
export async function fetchSessionInfoService(thoughtspotHost: string): Promise<any> {
19✔
UNCOV
29
    const sessionInfoPath = `${thoughtspotHost}${EndPoints.SESSION_INFO}`;
×
UNCOV
30
    const response = await tokenizedFailureLoggedFetch(sessionInfoPath);
×
UNCOV
31
    if (!response.ok) {
×
UNCOV
32
        throw new Error(`Failed to fetch session info: ${response.statusText}`);
×
33
    }
UNCOV
34
    const data = await response.json();
×
UNCOV
35
    return data;
×
36
}
37

38
/**
39
 *
40
 * @param thoughtSpotHost
41
 */
42
export async function fetchLogoutService(thoughtSpotHost: string): Promise<any> {
19✔
UNCOV
43
    return tokenizedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
×
44
        credentials: 'include',
45
        method: 'POST',
46
        headers: {
47
            'x-requested-by': 'ThoughtSpot',
48
        },
49
    });
50
}
51

52
/**
53
 * Is active service to check if the user is logged in.
54
 * @param thoughtSpotHost
55
 * @version SDK: 1.28.4 | ThoughtSpot: *
56
 */
57
export async function isActiveService(thoughtSpotHost: string): Promise<boolean> {
19✔
58
    const isActiveUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
3✔
59
    try {
3✔
60
        const res = await tokenizedFetch(isActiveUrl, {
3✔
61
            credentials: 'include',
62
        });
63
        return res.ok;
2✔
64
    } catch (e) {
65
        logger.warn(`Is Logged In Service failed : ${e.message}`);
1✔
66
    }
67

68
    return false;
1✔
69
}
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