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

ringcentral / ringcentral-js / 5286631680

pending completion
5286631680

push

github

web-flow
chore: fix sandbox status 502 issue (#219)

260 of 335 branches covered (77.61%)

Branch coverage included in aggregate %.

766 of 792 relevant lines covered (96.72%)

41.45 hits per line

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

75.68
/sdk/src/core/Externals.ts
1
const root =
2
    (typeof window !== 'undefined' && window) ||
1!
3
    (typeof global !== 'undefined' && global) ||
4
    (function getRoot() {
5
        return this;
×
6
    })();
7

8
export interface ExternalsOptions {
9
    fetch?: typeof fetch;
10
    Request?: typeof Request;
11
    Response?: typeof Response;
12
    Headers?: typeof Headers;
13
    localStorage?: Storage;
14
}
15

16
export default class Externals implements ExternalsOptions {
1✔
17
    public fetch = root.fetch;
96✔
18

19
    public Request = root.Request;
96✔
20

21
    public Response = root.Response;
96✔
22

23
    public Headers = root.Headers;
96✔
24

25
    public localStorage = root.localStorage;
96✔
26

27
    public constructor({
96✔
28
        fetch: fetchImpl,
96✔
29
        Request: RequestImpl,
96✔
30
        Response: ResponseImpl,
96✔
31
        Headers: HeadersImpl,
96✔
32
        localStorage,
96✔
33
    }: ExternalsOptions = {}) {
96!
34
        if (fetchImpl) this.fetch = fetchImpl;
96!
35
        if (RequestImpl) this.Request = RequestImpl;
96!
36
        if (ResponseImpl) this.Response = ResponseImpl;
96!
37
        if (HeadersImpl) this.Headers = HeadersImpl;
96!
38
        if (localStorage) this.localStorage = localStorage;
96!
39

40
        /* istanbul ignore next */
41
        if (!this.fetch || !this.Response || !this.Request || !this.Headers) {
42
            throw new Error('Fetch API is missing');
43
        }
44

45
        /* istanbul ignore next */
46
        if (!this.localStorage) {
47
            throw new Error('LocalStorage is missing');
48
        }
49
    }
50
}
1✔
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