-
Notifications
You must be signed in to change notification settings - Fork 236
Expand file tree
/
Copy pathGraphClientError.ts
More file actions
34 lines (29 loc) · 1.32 KB
/
GraphClientError.ts
File metadata and controls
34 lines (29 loc) · 1.32 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
32
33
34
/**
* -------------------------------------------------------------------------------------------
* 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 { GraphClientError } from "../../../src/GraphClientError";
describe("GraphClientError", () => {
const message = "test";
const name = "test_name";
it("Should return GraphClientError error with message set", () => {
const gError = new GraphClientError(message);
assert.equal(gError.message, message);
});
it("Should return GraphClientError when Error object is passed", () => {
const errorParameter = new Error(message);
errorParameter.name = name;
const gError = GraphClientError.setGraphClientError(errorParameter);
assert.equal(gError.message, message);
assert.equal(gError.name, name);
});
it("Should return GraphClientError when custom error object is passed", () => {
const customErrorParameter = { errorName: name, errorMessage: message };
const gError = GraphClientError.setGraphClientError(customErrorParameter);
assert.isDefined(gError.customError);
assert.equal(gError.customError, customErrorParameter);
});
});