Skip to content

Commit 86d3bff

Browse files
committed
sorting the graph responsehandler tests
1 parent 6330bfb commit 86d3bff

File tree

302 files changed

+1303
-12315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+1303
-12315
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ samples/browser/src/secrets.js
2323
samples/browser/src/graph-js-sdk.js
2424
samples/browser/src/graph-es-sdk.js
2525

26-
spec/**/*.js
27-
spec/**/*.d.ts
28-
spec/**/*.js.map
26+
2927
spec/**/secrets.ts
3028

3129
.nyc_output/*

.huskyrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"hooks": {
3-
"pre-commit": "npm run buid"
3+
"pre-commit": "npm run build"
44
}
55
}

karma.conf.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module.exports = function(config) {
2-
config.set({
3-
frameworks: ["mocha", "chai", "karma-typescript"],
4-
files: ["test/common/**/*.ts", "src/**/*.ts", "test/browser/**/*.ts"],
5-
preprocessors: {
6-
"**/*.ts": ["karma-typescript"],
7-
},
8-
karmaTypescriptConfig: {
9-
tsconfig: "./test/tsconfig-es.json",
10-
},
11-
browsers: ["ChromeHeadless"],
12-
});
13-
};
2+
config.set({
3+
frameworks: ["mocha", "chai", "karma-typescript"],
4+
files: ["test/common/**/*.ts", "src/**/*.ts", "test/browser/**/*.ts", "test/*.ts"],
5+
preprocessors: {
6+
"**/*.ts": ["karma-typescript"],
7+
},
8+
karmaTypescriptConfig: {
9+
tsconfig: "./tsconfig-cjs.json",
10+
},
11+
browsers: ["ChromeHeadless"],
12+
});
13+
};

package-lock.json

Lines changed: 12 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 97 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,99 @@
11
{
2-
"name": "@microsoft/microsoft-graph-client",
3-
"version": "2.1.0-Preview.2",
4-
"description": "Microsoft Graph Client Library",
5-
"license": "MIT",
6-
"main": "lib/src/index.js",
7-
"module": "lib/es/index.js",
8-
"typings": "lib/src/index",
9-
"files": [
10-
"lib/",
11-
"src/"
12-
],
13-
"types": "./lib/src/index.d.ts",
14-
"dependencies": {
15-
"@babel/runtime": "^7.4.4",
16-
"esm": "^3.2.25",
17-
"karma": "^5.2.3",
18-
"tslib": "^1.9.3"
19-
},
20-
"devDependencies": {
21-
"@babel/core": "^7.4.4",
22-
"@babel/plugin-transform-runtime": "^7.4.4",
23-
"@babel/preset-env": "^7.4.4",
24-
"@istanbuljs/nyc-config-typescript": "^1.0.1",
25-
"@types/chai": "^4.2.14",
26-
"@types/mocha": "^5.2.7",
27-
"@types/node": "^12.0.10",
28-
"chai": "^4.2.0",
29-
"gulp": "^4.0.2",
30-
"husky": "^2.2.0",
31-
"isomorphic-fetch": "^2.2.1",
32-
"karma-chai": "^0.1.0",
33-
"karma-chrome-launcher": "^3.1.0",
34-
"karma-firefox-launcher": "^2.1.0",
35-
"karma-mocha": "^2.0.1",
36-
"karma-typescript": "^5.2.0",
37-
"lint-staged": "^8.1.5",
38-
"mocha": "^6.2.3",
39-
"msal": "^1.0.0",
40-
"nyc": "^15.1.0",
41-
"prettier": "^1.17.0",
42-
"puppeteer": "^5.5.0",
43-
"rollup": "^1.10.1",
44-
"rollup-plugin-babel": "^4.3.2",
45-
"rollup-plugin-commonjs": "^10.0.1",
46-
"rollup-plugin-node-resolve": "^5.2.0",
47-
"rollup-plugin-terser": "^5.0.0",
48-
"source-map-support": "^0.5.19",
49-
"ts-node": "^9.0.0",
50-
"tslint": "^5.16.0",
51-
"tslint-config-prettier": "^1.18.0",
52-
"typescript": "^3.4.5",
53-
"uglify-es": "^3.3.9"
54-
},
55-
"scripts": {
56-
"setVersion": "gulp setVersion",
57-
"build:es": "tsc --p tsconfig-es.json",
58-
"build:cjs": "tsc --p tsconfig-cjs.json",
59-
"pre-build": "npm run setVersion",
60-
"build": "npm run pre-build && npm run build:cjs && npm run build:es && rollup -c",
61-
"test": "npm run build:cjs && mocha lib/spec/content && mocha lib/spec/core && mocha lib/spec/middleware && mocha lib/spec/tasks",
62-
"test:content": "tsc --p spec/tsconfig.json && mocha spec/content",
63-
"test:core": "tsc --p spec/tsconfig.json && mocha spec/core",
64-
"test:middleware": "tsc --p spec/tsconfig.json && mocha spec/middleware",
65-
"test:tasks": "tsc --p spec/tsconfig.json && mocha spec/tasks",
66-
"test:development": "tsc --p spec/tsconfig.json && mocha spec/development/workload",
67-
"test:workload": "tsc --p spec/tsconfig.json && mocha spec/development/workload",
68-
"lint": "tslint --project ./tsconfig-cjs.json -c tslint.json",
69-
"format:css": "prettier --write \"**/*.css\"",
70-
"format:html": "prettier --write \"**/*.html\"",
71-
"format:js": "prettier --write \"**/*.js\"",
72-
"format:json": "prettier --write \"**/*.json\"",
73-
"format:md": "prettier --write \"**/*.md\"",
74-
"format:rc": "prettier --write --parser json \"**/.*rc\"",
75-
"format:ts": "prettier --write \"**/*.ts\"",
76-
"format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts",
77-
"prepack": "npm install && npm run build && npm run test",
78-
"test:cjs": "mocha -r ts-node/register --project tsconfig-cjs.json spec/content/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/core/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/middleware/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/tasks/*.ts",
79-
"test:esm": "TS_NODE_PROJECT='./test/tsconfig-test-es.json' mocha --require esm test/dist/test/**/*.js",
80-
"test:es": "tsc -p ./test/tsconfig-test-es.json && mocha test/dist/**/*.js --require esm",
81-
"test:mocha": "nyc --require esm mocha -r ts-node/register spec/core/*.ts",
82-
"cover": "nyc npm run test",
83-
"coverage": "nyc npm run test:esm",
84-
"karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js"
85-
},
86-
"repository": {
87-
"type": "git",
88-
"url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git"
89-
},
90-
"nyc": {
91-
"all": true,
92-
"cache": false,
93-
"exclude": [
94-
"samples/",
95-
"*.js",
96-
"lib/"
97-
]
98-
}
2+
"name": "@microsoft/microsoft-graph-client",
3+
"version": "2.1.0-Preview.2",
4+
"description": "Microsoft Graph Client Library",
5+
"license": "MIT",
6+
"main": "lib/src/index.js",
7+
"module": "lib/es/index.js",
8+
"typings": "lib/src/index",
9+
"files": [
10+
"lib/",
11+
"src/"
12+
],
13+
"types": "./lib/src/index.d.ts",
14+
"dependencies": {
15+
"@babel/runtime": "^7.4.4",
16+
"esm": "^3.2.25",
17+
"karma": "^5.2.3",
18+
"tslib": "^1.9.3"
19+
},
20+
"devDependencies": {
21+
"@babel/core": "^7.4.4",
22+
"@babel/plugin-transform-runtime": "^7.4.4",
23+
"@babel/preset-env": "^7.4.4",
24+
"@istanbuljs/nyc-config-typescript": "^1.0.1",
25+
"@types/chai": "^4.2.14",
26+
"@types/mocha": "^5.2.7",
27+
"@types/node": "^12.0.10",
28+
"chai": "^4.2.0",
29+
"gulp": "^4.0.2",
30+
"husky": "^2.2.0",
31+
"isomorphic-fetch": "^3.0.0",
32+
"karma-chai": "^0.1.0",
33+
"karma-chrome-launcher": "^3.1.0",
34+
"karma-firefox-launcher": "^2.1.0",
35+
"karma-mocha": "^2.0.1",
36+
"karma-typescript": "^5.2.0",
37+
"lint-staged": "^8.1.5",
38+
"mocha": "^6.2.3",
39+
"msal": "^1.0.0",
40+
"nyc": "^15.1.0",
41+
"prettier": "^1.17.0",
42+
"puppeteer": "^5.5.0",
43+
"rollup": "^1.10.1",
44+
"rollup-plugin-babel": "^4.3.2",
45+
"rollup-plugin-commonjs": "^10.0.1",
46+
"rollup-plugin-node-resolve": "^5.2.0",
47+
"rollup-plugin-terser": "^5.0.0",
48+
"source-map-support": "^0.5.19",
49+
"ts-node": "^9.0.0",
50+
"tslint": "^5.16.0",
51+
"tslint-config-prettier": "^1.18.0",
52+
"typescript": "^3.4.5",
53+
"uglify-es": "^3.3.9"
54+
},
55+
"scripts": {
56+
"setVersion": "gulp setVersion",
57+
"build:es": "tsc --p tsconfig-es.json",
58+
"build:cjs": "tsc --p tsconfig-cjs.json",
59+
"pre-build": "npm run setVersion",
60+
"build": "npm run pre-build && npm run build:cjs && npm run build:es && rollup -c",
61+
"test": "npm run build:cjs && mocha lib/spec/content && mocha lib/spec/core && mocha lib/spec/middleware && mocha lib/spec/tasks",
62+
"test:content": "tsc --p spec/tsconfig.json && mocha spec/content",
63+
"test:core": "tsc --p spec/tsconfig.json && mocha spec/core",
64+
"test:middleware": "tsc --p spec/tsconfig.json && mocha spec/middleware",
65+
"test:tasks": "tsc --p spec/tsconfig.json && mocha spec/tasks",
66+
"test:development": "tsc --p spec/tsconfig.json && mocha spec/development/workload",
67+
"test:workload": "tsc --p spec/tsconfig.json && mocha spec/development/workload",
68+
"lint": "tslint --project ./tsconfig-cjs.json -c tslint.json",
69+
"format:css": "prettier --write \"**/*.css\"",
70+
"format:html": "prettier --write \"**/*.html\"",
71+
"format:js": "prettier --write \"**/*.js\"",
72+
"format:json": "prettier --write \"**/*.json\"",
73+
"format:md": "prettier --write \"**/*.md\"",
74+
"format:rc": "prettier --write --parser json \"**/.*rc\"",
75+
"format:ts": "prettier --write \"**/*.ts\"",
76+
"format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts",
77+
"prepack": "npm install && npm run build && npm run test",
78+
"test:cjs": "mocha -r ts-node/register --project tsconfig-cjs.json spec/content/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/core/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/middleware/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/tasks/*.ts",
79+
"test:esm": "TS_NODE_PROJECT='./test/tsconfig-test-es.json' mocha --require esm test/dist/test/**/*.js",
80+
"test:es": "tsc -p tsconfig-es.json && mocha lib/es/test/common/content --require esm && mocha lib/es/test/common/core --require esm && mocha lib/es/test/common/tasks --require esm && mocha lib/es/test/common/middleware --require esm",
81+
"test:mocha": "nyc --require esm mocha -r ts-node/register spec/core/*.ts",
82+
"cover": "nyc npm run test",
83+
"coverage": "nyc npm run test:esm",
84+
"karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js"
85+
},
86+
"repository": {
87+
"type": "git",
88+
"url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git"
89+
},
90+
"nyc": {
91+
"all": true,
92+
"cache": false,
93+
"exclude": [
94+
"samples/",
95+
"*.js",
96+
"lib/"
97+
]
98+
}
9999
}

src/GraphResponseHandler.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
/**
99
* @module GraphResponseHandler
10+
* References - https://fetch.spec.whatwg.org/#responses
1011
*/
1112

1213
import { GraphRequestCallback } from "./IGraphRequestCallback";
@@ -134,6 +135,7 @@ export class GraphResponseHandler {
134135
} else if (mimeType === ContentType.APPLICATION_JSON) {
135136
responseValue = await rawResponse.json();
136137
} else {
138+
// TODO - Update handling of responses where content-type is not unknown
137139
responseValue = Promise.resolve(rawResponse.body);
138140
}
139141
} else {
@@ -148,6 +150,8 @@ export class GraphResponseHandler {
148150
*
149151
* So assuming it as a stream type so returning the body.
150152
*/
153+
154+
// TODO - Update handling of responses where content-type is not present
151155
responseValue = Promise.resolve(rawResponse.body);
152156
}
153157
break;

src/content/BatchRequestContent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,10 @@ export class BatchRequestContent {
381381
}
382382
while (!cur.done) {
383383
const requestStep: BatchRequestStep = cur.value[1];
384-
const batchRequestData: BatchRequestData = (await BatchRequestContent.getRequestData(requestStep.request as IsomorphicRequest)) as BatchRequestData;
384+
const batchRequestData: BatchRequestData = (await BatchRequestContent.getRequestData(requestStep.request as IsomorphicRequest)) as BatchRequestData;
385385
/**
386+
* @see{@https://tools.ietf.org/html/rfc7578#section-4.4}
387+
* TODO- Setting/Defaulting of content-type header to the correct value
386388
* @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/json_batching#request-format}
387389
*/
388390
if (batchRequestData.body !== undefined && (batchRequestData.headers === undefined || batchRequestData.headers["content-type"] === undefined)) {

test/common/DummyHTTPMessageHandler.ts renamed to test/DummyHTTPMessageHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* @module DummyHTTPMessageHandler
1010
*/
1111

12-
import { Context } from "../../src/IContext";
13-
import { Middleware } from "../../src/middleware/IMiddleware";
12+
import { Context } from "../src/IContext";
13+
import { Middleware } from "../src/middleware/IMiddleware";
1414

1515
/**
1616
* @class

test/common/DummyHandlerOptions.ts renamed to test/DummyHandlerOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @module DummyHandlerOptions
1010
*/
1111

12-
import { MiddlewareOptions } from "../../src/middleware/options/IMiddlewareOptions";
12+
import { MiddlewareOptions } from "../src/middleware/options/IMiddlewareOptions";
1313

1414
/**
1515
* @class

0 commit comments

Comments
 (0)