forked from microsoftgraph/msgraph-sdk-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTTPClientFactory.ts
More file actions
31 lines (27 loc) · 1.39 KB
/
Copy pathHTTPClientFactory.ts
File metadata and controls
31 lines (27 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
import { assert } from "chai";
import { HTTPClient } from "../../../src/HTTPClient";
import { HTTPClientFactory } from "../../../src/HTTPClientFactory";
import { DummyAuthenticationProvider } from "../../DummyAuthenticationProvider";
import { DummyHTTPMessageHandler } from "../../DummyHTTPMessageHandler";
describe("HTTPClientFactory.ts", () => {
describe("createWithAuthenticationProvider", () => {
const dummyAuthProvider = new DummyAuthenticationProvider();
const dummyHTTPHandler = new DummyHTTPMessageHandler();
it("Should create an HTTPClient instance with default middleware chain", () => {
const client: HTTPClient = HTTPClientFactory.createWithAuthenticationProvider(dummyAuthProvider);
assert.isTrue(client instanceof HTTPClient);
assert.isDefined(client["middleware"]);
});
it("Should create an HTTPClient with given middleware chain", () => {
const client: HTTPClient = HTTPClientFactory.createWithMiddleware(dummyHTTPHandler);
assert.isTrue(client instanceof HTTPClient);
assert.isDefined(client["middleware"]);
});
});
});