Skip to content

Commit e756cb9

Browse files
author
Geoffrey Koros
committed
fix failing test for node version 18 & 20
1 parent 26f717c commit e756cb9

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

test/common/content/BatchRequestContent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ import { assert } from "chai";
1111

1212
import { BatchRequestContent, BatchRequestStep } from "../../../src/content/BatchRequestContent";
1313
import { randomString } from "../../test-helper";
14+
import { GRAPH_BASE_URL } from "../../../src/Constants";
1415

1516
const folderName = randomString();
1617
const folderDetails = {
1718
name: folderName,
1819
folder: {},
1920
};
2021

21-
const createFolderRequest = new Request("/me/drive/root/children", {
22+
const createFolderRequest = new Request(GRAPH_BASE_URL + "/me/drive/root/children", {
2223
method: "POST",
2324
headers: {
2425
"Content-type": "application/json",

test/common/core/HTTPClient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { HTTPClient } from "../../../src/HTTPClient";
1111
import { Context } from "../../../src/IContext";
1212
import { FetchOptions } from "../../../src/IFetchOptions";
1313
import { DummyHTTPMessageHandler } from "../../DummyHTTPMessageHandler";
14+
import { GRAPH_BASE_URL } from "../../../src/Constants";
1415

1516
describe("HTTPClient.ts", () => {
1617
const httpMessageHandler: DummyHTTPMessageHandler = new DummyHTTPMessageHandler();
@@ -63,7 +64,7 @@ describe("HTTPClient.ts", () => {
6364
});
6465

6566
it("Should execute for context object with Request instance", async () => {
66-
const request: Request = new Request("dummy_url", {
67+
const request: Request = new Request(GRAPH_BASE_URL + "dummy_url", {
6768
method: "GET",
6869
});
6970
const context: Context = {

test/common/middleware/AuthenticationHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("AuthenticationHandler.ts", async () => {
2626
});
2727
describe("Auth Headers", () => {
2828
it("Should delete Auth header when Request object is passed with non Graph URL", async () => {
29-
const request = new Request("test_url");
29+
const request = new Request(GRAPH_BASE_URL + "test_url");
3030
const context: Context = {
3131
request,
3232
options: {

test/common/middleware/MiddlewareUtil.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { assert } from "chai";
99

1010
import { FetchOptions } from "../../../src/IFetchOptions";
1111
import { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from "../../../src/middleware/MiddlewareUtil";
12+
import { GRAPH_BASE_URL } from "../../../src/Constants";
1213

1314
describe("MiddlewareUtil.ts", async () => {
1415
function getMultipleValuesForHeader(headers: Headers, key: string): string[] {
@@ -23,7 +24,7 @@ describe("MiddlewareUtil.ts", async () => {
2324
describe("getRequestHeader", () => {
2425
const key = "Content-Type";
2526
const value = "application/json";
26-
const url = "dummy_url";
27+
const url = GRAPH_BASE_URL + "/dummy_url";
2728
it("Should get header from request object", () => {
2829
const request: Request = new Request(url, {
2930
method: "test",
@@ -76,7 +77,7 @@ describe("MiddlewareUtil.ts", async () => {
7677
describe("setRequestHeader", () => {
7778
const key = "Content-Type";
7879
const value = "application/json";
79-
const url = "dummy_url";
80+
const url = GRAPH_BASE_URL + "dummy_url";
8081
it("Should set header in request object", () => {
8182
const request: Request = new Request(url, {
8283
method: "test",
@@ -179,7 +180,7 @@ describe("MiddlewareUtil.ts", async () => {
179180
const key = "Content-Type";
180181
const value = "application/json";
181182
const firstValue = "text/html";
182-
const url = "dummy_url";
183+
const url = GRAPH_BASE_URL + "dummy_url";
183184
it("Should set header in request object if the header is not present", () => {
184185
const request: Request = new Request(url, {
185186
method: "test",

test/common/middleware/TelemetryHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe("TelemetryHandler.ts", () => {
121121
});
122122

123123
it("Should delete Telemetry in the header when Request object is passed with non Graph URL", async () => {
124-
const request = new Request("test_url");
124+
const request = new Request(GRAPH_BASE_URL + "test_url");
125125
const context: Context = {
126126
request,
127127
options: {

test/node/content/BatchRequestContent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { assert } from "chai";
1111
import * as fs from "fs";
1212

1313
import { BatchRequestContent } from "../../../src/content/BatchRequestContent";
14+
import { GRAPH_BASE_URL } from "../../../src/Constants";
1415

1516
describe("BatchRequestContent.ts", () => {
1617
describe("getContent", () => {
@@ -22,7 +23,7 @@ describe("BatchRequestContent.ts", () => {
2223
}
2324
const uploadOneDriveFile = {
2425
id: "1",
25-
request: new Request(`/me/drive/root:/Documents/${fileName}:/content`, {
26+
request: new Request(`${GRAPH_BASE_URL}me/drive/root:/Documents/${fileName}:/content`, {
2627
method: "PUT",
2728
headers: {
2829
"Content-type": "image/jpg",

0 commit comments

Comments
 (0)