@flink-app/test-utils 0.11.4-next.0 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http.d.ts +1 -1
- package/dist/http.js +22 -21
- package/dist/index.js +1 -5
- package/dist/mocks.js +6 -5
- package/package.json +31 -31
package/dist/http.d.ts
CHANGED
package/dist/http.js
CHANGED
|
@@ -20,12 +20,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g
|
|
24
|
-
return g
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (
|
|
28
|
+
while (_) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -50,11 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.init =
|
|
54
|
-
exports.get = get;
|
|
55
|
-
exports.post = post;
|
|
56
|
-
exports.put = put;
|
|
57
|
-
exports.del = del;
|
|
53
|
+
exports.del = exports.put = exports.post = exports.get = exports.init = void 0;
|
|
58
54
|
var got_1 = __importDefault(require("got"));
|
|
59
55
|
var qs_1 = __importDefault(require("qs"));
|
|
60
56
|
var app;
|
|
@@ -71,12 +67,13 @@ var gotOpts = {
|
|
|
71
67
|
function init(_app, host) {
|
|
72
68
|
if (host === void 0) { host = "localhost"; }
|
|
73
69
|
app = _app;
|
|
74
|
-
baseUrl = "http://"
|
|
70
|
+
baseUrl = "http://" + host + ":" + app.port;
|
|
75
71
|
}
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
exports.init = init;
|
|
73
|
+
function get(path, opts) {
|
|
74
|
+
if (opts === void 0) { opts = {}; }
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
76
|
var res;
|
|
79
|
-
if (opts === void 0) { opts = {}; }
|
|
80
77
|
return __generator(this, function (_a) {
|
|
81
78
|
switch (_a.label) {
|
|
82
79
|
case 0:
|
|
@@ -89,10 +86,11 @@ function get(path_1) {
|
|
|
89
86
|
});
|
|
90
87
|
});
|
|
91
88
|
}
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
exports.get = get;
|
|
90
|
+
function post(path, body, opts) {
|
|
91
|
+
if (opts === void 0) { opts = {}; }
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
93
|
var res;
|
|
95
|
-
if (opts === void 0) { opts = {}; }
|
|
96
94
|
return __generator(this, function (_a) {
|
|
97
95
|
switch (_a.label) {
|
|
98
96
|
case 0:
|
|
@@ -105,10 +103,11 @@ function post(path_1, body_1) {
|
|
|
105
103
|
});
|
|
106
104
|
});
|
|
107
105
|
}
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
exports.post = post;
|
|
107
|
+
function put(path, body, opts) {
|
|
108
|
+
if (opts === void 0) { opts = {}; }
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
110
|
var res;
|
|
111
|
-
if (opts === void 0) { opts = {}; }
|
|
112
111
|
return __generator(this, function (_a) {
|
|
113
112
|
switch (_a.label) {
|
|
114
113
|
case 0:
|
|
@@ -121,10 +120,11 @@ function put(path_1, body_1) {
|
|
|
121
120
|
});
|
|
122
121
|
});
|
|
123
122
|
}
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
exports.put = put;
|
|
124
|
+
function del(path, opts) {
|
|
125
|
+
if (opts === void 0) { opts = {}; }
|
|
126
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
126
127
|
var res;
|
|
127
|
-
if (opts === void 0) { opts = {}; }
|
|
128
128
|
return __generator(this, function (_a) {
|
|
129
129
|
switch (_a.label) {
|
|
130
130
|
case 0:
|
|
@@ -137,6 +137,7 @@ function del(path_1) {
|
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
+
exports.del = del;
|
|
140
141
|
function validateApp() {
|
|
141
142
|
if (!app) {
|
|
142
143
|
throw new Error("App not initialized, run `init(app)` prior to invoking get/post/put/del");
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
package/dist/mocks.js
CHANGED
|
@@ -20,12 +20,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g
|
|
24
|
-
return g
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (
|
|
28
|
+
while (_) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -47,8 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.mockReq =
|
|
51
|
-
exports.noOpAuthPlugin = noOpAuthPlugin;
|
|
50
|
+
exports.noOpAuthPlugin = exports.mockReq = void 0;
|
|
52
51
|
/**
|
|
53
52
|
* Creates a mocked FlinkRequest object where only essential properties are required.
|
|
54
53
|
* Will convert req body to JSON to ensure the body is a plain object.
|
|
@@ -65,6 +64,7 @@ function mockReq(req) {
|
|
|
65
64
|
req.params = req.params ? JSON.parse(JSON.stringify(req.params)) : {};
|
|
66
65
|
return aMockReq;
|
|
67
66
|
}
|
|
67
|
+
exports.mockReq = mockReq;
|
|
68
68
|
/**
|
|
69
69
|
* Auth plugin used for testing handlers.
|
|
70
70
|
* Will allow all requests.
|
|
@@ -81,3 +81,4 @@ function noOpAuthPlugin() {
|
|
|
81
81
|
}); }); },
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
+
exports.noOpAuthPlugin = noOpAuthPlugin;
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
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
|
-
|
|
2
|
+
"name": "@flink-app/test-utils",
|
|
3
|
+
"version": "0.11.4",
|
|
4
|
+
"description": "Test utils for Flink",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\"",
|
|
7
|
+
"prepublish": "tsc",
|
|
8
|
+
"watch": "tsc-watch"
|
|
9
|
+
},
|
|
10
|
+
"author": "joel@frost.se",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"got": "^9.6.0",
|
|
19
|
+
"qs": "^6.7.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@flink-app/flink": "^0.11.4",
|
|
23
|
+
"@types/express": "^4.17.12",
|
|
24
|
+
"@types/got": "^9.6.12",
|
|
25
|
+
"@types/node": "^15.6.2",
|
|
26
|
+
"jasmine-spec-reporter": "^7.0.0",
|
|
27
|
+
"nodemon": "^2.0.7",
|
|
28
|
+
"ts-node": "^9.1.1",
|
|
29
|
+
"tsc-watch": "^4.2.9",
|
|
30
|
+
"typescript": "^4.2.4"
|
|
31
|
+
},
|
|
32
|
+
"gitHead": "5f36b236f3059fbd77cb01b363d60e3061bdf714"
|
|
33
33
|
}
|