@flink-app/test-utils 0.11.0 → 0.11.4-next.0
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 +21 -22
- package/dist/index.js +5 -1
- package/dist/mocks.js +5 -6
- 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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["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 (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) 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,7 +50,11 @@ 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.
|
|
53
|
+
exports.init = init;
|
|
54
|
+
exports.get = get;
|
|
55
|
+
exports.post = post;
|
|
56
|
+
exports.put = put;
|
|
57
|
+
exports.del = del;
|
|
54
58
|
var got_1 = __importDefault(require("got"));
|
|
55
59
|
var qs_1 = __importDefault(require("qs"));
|
|
56
60
|
var app;
|
|
@@ -67,13 +71,12 @@ var gotOpts = {
|
|
|
67
71
|
function init(_app, host) {
|
|
68
72
|
if (host === void 0) { host = "localhost"; }
|
|
69
73
|
app = _app;
|
|
70
|
-
baseUrl = "http://"
|
|
74
|
+
baseUrl = "http://".concat(host, ":").concat(app.port);
|
|
71
75
|
}
|
|
72
|
-
|
|
73
|
-
function
|
|
74
|
-
if (opts === void 0) { opts = {}; }
|
|
75
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
function get(path_1) {
|
|
77
|
+
return __awaiter(this, arguments, void 0, function (path, opts) {
|
|
76
78
|
var res;
|
|
79
|
+
if (opts === void 0) { opts = {}; }
|
|
77
80
|
return __generator(this, function (_a) {
|
|
78
81
|
switch (_a.label) {
|
|
79
82
|
case 0:
|
|
@@ -86,11 +89,10 @@ function get(path, opts) {
|
|
|
86
89
|
});
|
|
87
90
|
});
|
|
88
91
|
}
|
|
89
|
-
|
|
90
|
-
function
|
|
91
|
-
if (opts === void 0) { opts = {}; }
|
|
92
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
function post(path_1, body_1) {
|
|
93
|
+
return __awaiter(this, arguments, void 0, function (path, body, opts) {
|
|
93
94
|
var res;
|
|
95
|
+
if (opts === void 0) { opts = {}; }
|
|
94
96
|
return __generator(this, function (_a) {
|
|
95
97
|
switch (_a.label) {
|
|
96
98
|
case 0:
|
|
@@ -103,11 +105,10 @@ function post(path, body, opts) {
|
|
|
103
105
|
});
|
|
104
106
|
});
|
|
105
107
|
}
|
|
106
|
-
|
|
107
|
-
function
|
|
108
|
-
if (opts === void 0) { opts = {}; }
|
|
109
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
function put(path_1, body_1) {
|
|
109
|
+
return __awaiter(this, arguments, void 0, function (path, body, opts) {
|
|
110
110
|
var res;
|
|
111
|
+
if (opts === void 0) { opts = {}; }
|
|
111
112
|
return __generator(this, function (_a) {
|
|
112
113
|
switch (_a.label) {
|
|
113
114
|
case 0:
|
|
@@ -120,11 +121,10 @@ function put(path, body, opts) {
|
|
|
120
121
|
});
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
|
-
|
|
124
|
-
function
|
|
125
|
-
if (opts === void 0) { opts = {}; }
|
|
126
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
+
function del(path_1) {
|
|
125
|
+
return __awaiter(this, arguments, void 0, function (path, opts) {
|
|
127
126
|
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,7 +137,6 @@ function del(path, opts) {
|
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
exports.del = del;
|
|
141
140
|
function validateApp() {
|
|
142
141
|
if (!app) {
|
|
143
142
|
throw new Error("App not initialized, run `init(app)` prior to invoking get/post/put/del");
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
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
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["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 (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) 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,7 +47,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.
|
|
50
|
+
exports.mockReq = mockReq;
|
|
51
|
+
exports.noOpAuthPlugin = noOpAuthPlugin;
|
|
51
52
|
/**
|
|
52
53
|
* Creates a mocked FlinkRequest object where only essential properties are required.
|
|
53
54
|
* Will convert req body to JSON to ensure the body is a plain object.
|
|
@@ -64,7 +65,6 @@ function mockReq(req) {
|
|
|
64
65
|
req.params = req.params ? JSON.parse(JSON.stringify(req.params)) : {};
|
|
65
66
|
return aMockReq;
|
|
66
67
|
}
|
|
67
|
-
exports.mockReq = mockReq;
|
|
68
68
|
/**
|
|
69
69
|
* Auth plugin used for testing handlers.
|
|
70
70
|
* Will allow all requests.
|
|
@@ -81,4 +81,3 @@ 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-next.0",
|
|
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-next.0",
|
|
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": "^10.9.2",
|
|
29
|
+
"tsc-watch": "^4.2.9",
|
|
30
|
+
"typescript": "5.6.2"
|
|
31
|
+
},
|
|
32
|
+
"gitHead": "6a44df1b6601c86ea3402750b939784d003202c3"
|
|
33
33
|
}
|