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

microsoft / botbuilder-js / 6394042052

03 Oct 2023 02:00PM CUT coverage: 84.869%. Remained the same
6394042052

push

github

web-flow
chore(deps): bump get-func-name from 2.0.0 to 2.0.2 (#4540)

Bumps [get-func-name](https://github.com/chaijs/get-func-name) from 2.0.0 to 2.0.2.
- [Release notes](https://github.com/chaijs/get-func-name/releases)
- [Commits](https://github.com/chaijs/get-func-name/commits/v2.0.2)

---
updated-dependencies:
- dependency-name: get-func-name
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

9920 of 12935 branches covered (0.0%)

Branch coverage included in aggregate %.

20177 of 22528 relevant lines covered (89.56%)

7197.22 hits per line

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

16.67
/libraries/botframework-connector/src/emulatorApiClient.ts
1
/**
2
 * @module botframework-connector
3
 */
4
/**
5
 * Copyright (c) Microsoft Corporation. All rights reserved.
6
 * Licensed under the MIT License.
7
 */
8

9
import { AppCredentials } from './auth/appCredentials';
10
import fetch from 'cross-fetch';
2✔
11

12
/**
13
 * The purpose of this class is to emulate an api client.
14
 */
15
export class EmulatorApiClient {
2✔
16
    /**
17
     * OAuth card emulation.
18
     *
19
     * @remarks If the emulation fails, an error containing the status code from the server is thrown.
20
     *
21
     * @param credentials [AppCredentials](xref:botframework-connector.AppCredentials) for OAuth.
22
     * @param emulatorUrl The URL of the emulator.
23
     * @param emulate `true` to send an emulated OAuth card to the emulator; or `false` to not send the card.
24
     * @returns `true` on a successful emulation of OAuthCards.
25
     */
26
    static async emulateOAuthCards(
27
        credentials: AppCredentials,
28
        emulatorUrl: string,
29
        emulate: boolean
30
    ): Promise<boolean> {
31
        const token = await credentials.getToken();
×
32
        const requestUrl: string =
33
            emulatorUrl +
×
34
            (emulatorUrl.endsWith('/') ? '' : '/') +
×
35
            `api/usertoken/emulateOAuthCards?emulate=${(!!emulate).toString()}`;
36
        const res = await fetch(requestUrl, {
×
37
            method: 'POST',
38
            headers: {
39
                Authorization: `Bearer ${token}`,
40
            },
41
        });
42

43
        if (res.ok) {
×
44
            return true;
×
45
        } else {
46
            throw new Error(`EmulateOAuthCards failed with status code: ${res.status}`);
×
47
        }
48
    }
49
}
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