@sera4/essentia 1.1.42 → 1.1.43
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/helpers/test-server-wrapper.js +23 -20
- package/package.json +1 -1
- package/package.tar.gz +0 -0
|
@@ -15,7 +15,7 @@ export class TestServerWrapper {
|
|
|
15
15
|
this.chai = chai;
|
|
16
16
|
|
|
17
17
|
// Support for older/deprecated apis
|
|
18
|
-
const oldAuthHeaders = {
|
|
18
|
+
const oldAuthHeaders = {headers: {"Authorization" : `Token organization_token=${oldAuthToken}`}};
|
|
19
19
|
this.v1 = {
|
|
20
20
|
get: (url) => this.getWithPrefix("/v1", url, oldAuthHeaders),
|
|
21
21
|
post: (url) => this.postWithPrefix("/v1", url, oldAuthHeaders),
|
|
@@ -58,8 +58,8 @@ export class TestServerWrapper {
|
|
|
58
58
|
const request = this.chai.request(this.server).get(`${prefix}${sanitizedUrl}`);
|
|
59
59
|
this.applyHeaders(request, this.defaultHeaders);
|
|
60
60
|
|
|
61
|
-
if (options?.
|
|
62
|
-
this.applyHeaders(request,
|
|
61
|
+
if (options?.headers) {
|
|
62
|
+
this.applyHeaders(request, options.headers);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
if (options?.body) {
|
|
@@ -77,9 +77,10 @@ export class TestServerWrapper {
|
|
|
77
77
|
const request = this.chai.request(this.server).post(`${prefix}${sanitizedUrl}`);
|
|
78
78
|
this.applyHeaders(request, this.defaultHeaders);
|
|
79
79
|
|
|
80
|
-
if (options?.
|
|
81
|
-
this.applyHeaders(request,
|
|
80
|
+
if (options?.headers) {
|
|
81
|
+
this.applyHeaders(request, options.headers);
|
|
82
82
|
}
|
|
83
|
+
|
|
83
84
|
return request;
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -92,9 +93,10 @@ export class TestServerWrapper {
|
|
|
92
93
|
const request = this.chai.request(this.server).put(`${prefix}${sanitizedUrl}`);
|
|
93
94
|
this.applyHeaders(request, this.defaultHeaders);
|
|
94
95
|
|
|
95
|
-
if (options?.
|
|
96
|
-
this.applyHeaders(request,
|
|
96
|
+
if (options?.headers) {
|
|
97
|
+
this.applyHeaders(request, options.headers);
|
|
97
98
|
}
|
|
99
|
+
|
|
98
100
|
return request;
|
|
99
101
|
}
|
|
100
102
|
|
|
@@ -107,9 +109,10 @@ export class TestServerWrapper {
|
|
|
107
109
|
const request = this.chai.request(this.server).delete(`${prefix}${sanitizedUrl}`);
|
|
108
110
|
this.applyHeaders(request, this.defaultHeaders);
|
|
109
111
|
|
|
110
|
-
if (options?.
|
|
111
|
-
this.applyHeaders(request,
|
|
112
|
+
if (options?.headers) {
|
|
113
|
+
this.applyHeaders(request, options.headers);
|
|
112
114
|
}
|
|
115
|
+
|
|
113
116
|
return request;
|
|
114
117
|
}
|
|
115
118
|
|
|
@@ -122,8 +125,8 @@ export class TestServerWrapper {
|
|
|
122
125
|
const request = this.chai.request(this.server).post(`${prefix}${sanitizedUrl}`);
|
|
123
126
|
this.applyHeaders(request, this.defaultHeaders);
|
|
124
127
|
|
|
125
|
-
if (options?.
|
|
126
|
-
this.applyHeaders(request,
|
|
128
|
+
if (options?.headers) {
|
|
129
|
+
this.applyHeaders(request, options.headers);
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
request.attach("data", fs.readFileSync(file), {filename: "data"});
|
|
@@ -142,13 +145,13 @@ export class TestServerWrapper {
|
|
|
142
145
|
return this.routePrinter.getAll();
|
|
143
146
|
}
|
|
144
147
|
|
|
145
|
-
|
|
148
|
+
withHeaders (headers) {
|
|
146
149
|
return {
|
|
147
|
-
get: (url, options) => this.get(url, {
|
|
148
|
-
post: (url, options) => this.post(url, {
|
|
149
|
-
put: (url, options) => this.put(url, {
|
|
150
|
-
delete: (url, options) => this.delete(url, {
|
|
151
|
-
upload: (url, fields, file, options) => this.upload(url, fields, file, {
|
|
150
|
+
get: (url, options) => this.get(url, {headers, ...options}),
|
|
151
|
+
post: (url, options) => this.post(url, {headers, ...options}),
|
|
152
|
+
put: (url, options) => this.put(url, {headers, ...options}),
|
|
153
|
+
delete: (url, options) => this.delete(url, {headers, ...options}),
|
|
154
|
+
upload: (url, fields, file, options) => this.upload(url, fields, file, {headers, ...options}),
|
|
152
155
|
stop: this.stop,
|
|
153
156
|
allRoutes: this.allRoutes,
|
|
154
157
|
v1: this.v1
|
|
@@ -156,8 +159,8 @@ export class TestServerWrapper {
|
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
withMembership (m) {
|
|
159
|
-
const h = {
|
|
160
|
-
return this.
|
|
162
|
+
const h = { "tws-membership" : JSON.stringify(m) }
|
|
163
|
+
return this.withHeaders(h);
|
|
161
164
|
}
|
|
162
165
|
|
|
163
166
|
withS4 () {
|
|
@@ -167,4 +170,4 @@ export class TestServerWrapper {
|
|
|
167
170
|
withTap() {
|
|
168
171
|
return this.withMembership({s4_role: 2, id: uuidv4(), account_id: uuidv4(), tenant_id: uuidv4()});
|
|
169
172
|
}
|
|
170
|
-
}
|
|
173
|
+
}
|
package/package.json
CHANGED
package/package.tar.gz
CHANGED
|
Binary file
|