@studyportals/sp-lurch-interface 3.0.0 → 3.1.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/index.d.ts +21 -21
- package/index.js +33 -33
- package/package.json +29 -23
- package/src/entities/organisation/i-organisation.interface.d.ts +5 -5
- package/src/entities/organisation/i-organisation.interface.js +2 -2
- package/src/entities/organisation/organisation-dto.class.d.ts +7 -7
- package/src/entities/organisation/organisation-dto.class.js +11 -11
- package/src/entities/organisation/organisations-dto.d.ts +6 -6
- package/src/entities/organisation/organisations-dto.js +10 -10
- package/src/input-batches/input-batch-dto.class.d.ts +15 -15
- package/src/input-batches/input-batch-dto.class.js +19 -19
- package/src/input-batches/input-batch-status.d.ts +5 -5
- package/src/input-batches/input-batch-status.js +9 -9
- package/src/input-batches/input-batch-status.js.map +1 -1
- package/src/input-batches/interfaces/i-input-batch.interface.d.ts +13 -13
- package/src/input-batches/interfaces/i-input-batch.interface.js +2 -2
- package/src/intakes/intake-dto.class.d.ts +14 -14
- package/src/intakes/intake-dto.class.js +17 -17
- package/src/intakes/intake-stage-type.d.ts +6 -6
- package/src/intakes/intake-stage-type.js +10 -10
- package/src/intakes/intake-stage-type.js.map +1 -1
- package/src/intakes/interfaces/i-intake.interface.d.ts +12 -12
- package/src/intakes/interfaces/i-intake.interface.js +2 -2
- package/src/intakes/interfaces/i-match.interface.d.ts +4 -4
- package/src/intakes/interfaces/i-match.interface.js +2 -2
- package/src/intakes/match-dto.class.d.ts +6 -6
- package/src/intakes/match-dto.class.js +10 -10
- package/src/lurch-client.d.ts +19 -19
- package/src/lurch-client.js +57 -76
- package/src/lurch-client.js.map +1 -1
- package/src/results/discard-input-batch-result.class.d.ts +6 -6
- package/src/results/discard-input-batch-result.class.js +16 -16
- package/src/results/microsite-student-profile-result.class.d.ts +8 -8
- package/src/results/microsite-student-profile-result.class.js +18 -18
- package/src/results/retrieve-input-batch-result.class.d.ts +8 -8
- package/src/results/retrieve-input-batch-result.class.js +18 -18
- package/src/results/retrieve-input-batches-result.class.d.ts +8 -8
- package/src/results/retrieve-input-batches-result.class.js +18 -18
- package/src/results/retrieve-intake-result.class.d.ts +8 -8
- package/src/results/retrieve-intake-result.class.js +18 -18
- package/src/results/retrieve-intakes-result.class.d.ts +8 -8
- package/src/results/retrieve-intakes-result.class.js +18 -18
- package/src/results/retrieve-organisations-result.class.d.ts +9 -9
- package/src/results/retrieve-organisations-result.class.js +20 -20
- package/src/results/submit-matches-result.class.d.ts +6 -6
- package/src/results/submit-matches-result.class.js +16 -16
- package/src/student-profile/interfaces/I-microsite-student-profile.interface.d.ts +9 -9
- package/src/student-profile/interfaces/I-microsite-student-profile.interface.js +2 -2
- package/tests-u/entities/organisations/organisation-dto.test.d.ts +1 -1
- package/tests-u/entities/organisations/organisation-dto.test.js +61 -61
- package/tests-u/entities/organisations/organisation-dto.test.js.map +1 -1
- package/tests-u/input-batches/input-batch-dto.test.d.ts +1 -1
- package/tests-u/input-batches/input-batch-dto.test.js +149 -149
- package/tests-u/input-batches/input-batch-dto.test.js.map +1 -1
- package/tests-u/input-batches/input-batch-status.test.d.ts +1 -1
- package/tests-u/input-batches/input-batch-status.test.js +46 -46
- package/tests-u/input-batches/input-batch-status.test.js.map +1 -1
- package/tests-u/intakes/intake-dto.test.d.ts +1 -1
- package/tests-u/intakes/intake-dto.test.js +127 -127
- package/tests-u/intakes/intake-dto.test.js.map +1 -1
- package/tests-u/intakes/intake-stage-type.test.d.ts +1 -1
- package/tests-u/intakes/intake-stage-type.test.js +55 -55
- package/tests-u/intakes/intake-stage-type.test.js.map +1 -1
- package/tests-u/intakes/match-dto.test.d.ts +1 -1
- package/tests-u/intakes/match-dto.test.js +50 -50
- package/tests-u/intakes/match-dto.test.js.map +1 -1
- package/tests-u/lurch-client.test.d.ts +1 -1
- package/tests-u/lurch-client.test.js +271 -302
- package/tests-u/lurch-client.test.js.map +1 -1
- package/tests-u/results/discard-input-batch-result.test.d.ts +1 -1
- package/tests-u/results/discard-input-batch-result.test.js +39 -39
- package/tests-u/results/discard-input-batch-result.test.js.map +1 -1
- package/tests-u/results/retrieve-input-batch-result.test.d.ts +1 -1
- package/tests-u/results/retrieve-input-batch-result.test.js +50 -50
- package/tests-u/results/retrieve-input-batch-result.test.js.map +1 -1
- package/tests-u/results/retrieve-input-batches-result.test.d.ts +1 -1
- package/tests-u/results/retrieve-input-batches-result.test.js +50 -50
- package/tests-u/results/retrieve-input-batches-result.test.js.map +1 -1
- package/tests-u/results/retrieve-intake-result.test.d.ts +1 -1
- package/tests-u/results/retrieve-intake-result.test.js +50 -50
- package/tests-u/results/retrieve-intake-result.test.js.map +1 -1
- package/tests-u/results/retrieve-intakes-result.test.d.ts +1 -1
- package/tests-u/results/retrieve-intakes-result.test.js +50 -50
- package/tests-u/results/retrieve-intakes-result.test.js.map +1 -1
- package/tests-u/results/retrieve-organisation-result.test.d.ts +1 -1
- package/tests-u/results/retrieve-organisation-result.test.js +52 -52
- package/tests-u/results/retrieve-organisation-result.test.js.map +1 -1
- package/tests-u/results/submit-matches-result.test.d.ts +1 -1
- package/tests-u/results/submit-matches-result.test.js +30 -30
- package/tests-u/results/submit-matches-result.test.js.map +1 -1
- package/src/entities/organisation/main-organisations-dto.d.ts +0 -6
- package/src/entities/organisation/main-organisations-dto.js +0 -11
- package/src/entities/organisation/main-organisations-dto.js.map +0 -1
- package/src/results/retrieve-main-organisations-result.class.d.ts +0 -9
- package/src/results/retrieve-main-organisations-result.class.js +0 -21
- package/src/results/retrieve-main-organisations-result.class.js.map +0 -1
- package/src/student-profile/interfaces/I-student-profile.interface.d.ts +0 -9
- package/src/student-profile/interfaces/I-student-profile.interface.js +0 -3
- package/src/student-profile/interfaces/I-student-profile.interface.js.map +0 -1
- package/tests-u/results/retrieve-main-organisation-result.test.d.ts +0 -1
- package/tests-u/results/retrieve-main-organisation-result.test.js +0 -53
- package/tests-u/results/retrieve-main-organisation-result.test.js.map +0 -1
|
@@ -1,303 +1,272 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
get
|
|
28
|
-
return this.
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
this.mockedTestInstance.setup(_ => _["
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
const url = "SomeUrl";
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
mockedTestInstance.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
__metadata("design:
|
|
201
|
-
__metadata("design:
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
__metadata("design:
|
|
207
|
-
__metadata("design:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
__metadata("design:
|
|
213
|
-
__metadata("design:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
__metadata("design:
|
|
219
|
-
__metadata("design:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
__metadata("design:
|
|
225
|
-
__metadata("design:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
__metadata("design:
|
|
231
|
-
__metadata("design:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
__metadata("design:
|
|
237
|
-
__metadata("design:
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
__metadata("design:
|
|
243
|
-
__metadata("design:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
__metadata("design:
|
|
249
|
-
__metadata("design:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
__metadata("design:
|
|
255
|
-
__metadata("design:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
__metadata("design:
|
|
261
|
-
__metadata("design:
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
__metadata("design:
|
|
267
|
-
__metadata("design:
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
__metadata("design:type", Function),
|
|
273
|
-
__metadata("design:paramtypes", []),
|
|
274
|
-
__metadata("design:returntype", void 0)
|
|
275
|
-
], LurchClientTest.prototype, "createPostRequest__UrlCorrectlyBuilt", null);
|
|
276
|
-
__decorate([
|
|
277
|
-
mocha_typescript_1.test,
|
|
278
|
-
__metadata("design:type", Function),
|
|
279
|
-
__metadata("design:paramtypes", []),
|
|
280
|
-
__metadata("design:returntype", void 0)
|
|
281
|
-
], LurchClientTest.prototype, "createPostRequest__PostRequestCreatedAndProvided", null);
|
|
282
|
-
__decorate([
|
|
283
|
-
mocha_typescript_1.test,
|
|
284
|
-
__metadata("design:type", Function),
|
|
285
|
-
__metadata("design:paramtypes", []),
|
|
286
|
-
__metadata("design:returntype", Promise)
|
|
287
|
-
], LurchClientTest.prototype, "retrieveOrganisationsFromUser__GetRequestCreatedForCorrectPath", null);
|
|
288
|
-
__decorate([
|
|
289
|
-
mocha_typescript_1.test,
|
|
290
|
-
__metadata("design:type", Function),
|
|
291
|
-
__metadata("design:paramtypes", []),
|
|
292
|
-
__metadata("design:returntype", Promise)
|
|
293
|
-
], LurchClientTest.prototype, "retrieveOrganisationsFromUser__RequestSent", null);
|
|
294
|
-
__decorate([
|
|
295
|
-
mocha_typescript_1.test,
|
|
296
|
-
__metadata("design:type", Function),
|
|
297
|
-
__metadata("design:paramtypes", []),
|
|
298
|
-
__metadata("design:returntype", Promise)
|
|
299
|
-
], LurchClientTest.prototype, "retrieveOrganisationsFromUser__InputBatchesProvided", null);
|
|
300
|
-
LurchClientTest = __decorate([
|
|
301
|
-
mocha_typescript_1.suite
|
|
302
|
-
], LurchClientTest);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const chai_1 = require("chai");
|
|
13
|
+
const mocha_1 = require("@testdeck/mocha");
|
|
14
|
+
const typemoq_1 = require("typemoq");
|
|
15
|
+
const __1 = require("../");
|
|
16
|
+
const organisations_dto_1 = require("../src/entities/organisation/organisations-dto");
|
|
17
|
+
let LurchClientTest = class LurchClientTest {
|
|
18
|
+
get superAgentRequestFactory() {
|
|
19
|
+
return this.mockedSuperAgentRequestFactory.object;
|
|
20
|
+
}
|
|
21
|
+
get request() {
|
|
22
|
+
return this.mockedRequest.object;
|
|
23
|
+
}
|
|
24
|
+
get requestSender() {
|
|
25
|
+
return this.mockedRequestSender.object;
|
|
26
|
+
}
|
|
27
|
+
get testInstance() {
|
|
28
|
+
return this.mockedTestInstance.object;
|
|
29
|
+
}
|
|
30
|
+
before() {
|
|
31
|
+
this.mockedSuperAgentRequestFactory = typemoq_1.Mock.ofType();
|
|
32
|
+
this.mockedRequest = typemoq_1.Mock.ofType();
|
|
33
|
+
this.mockedRequestSender = typemoq_1.Mock.ofType();
|
|
34
|
+
const { mockedTestInstance } = this.createTestInstance();
|
|
35
|
+
this.mockedTestInstance = mockedTestInstance;
|
|
36
|
+
this.mockedTestInstance.setup(_ => _["createGetRequest"](typemoq_1.It.isAny()))
|
|
37
|
+
.returns(() => this.request);
|
|
38
|
+
this.mockedTestInstance.setup(_ => _["createPostRequest"](typemoq_1.It.isAny()))
|
|
39
|
+
.returns(() => this.request);
|
|
40
|
+
}
|
|
41
|
+
buildUrl__RelativePathConcatenatedToBaseUrl() {
|
|
42
|
+
const baseUrl = "SomeBaseUrl";
|
|
43
|
+
const relativePath = "SomeRelativePath";
|
|
44
|
+
const expectedResult = `${baseUrl}${relativePath}`;
|
|
45
|
+
this.mockedTestInstance.setup(_ => _["baseUrl"]).returns(() => baseUrl);
|
|
46
|
+
const result = this.testInstance["buildUrl"](relativePath);
|
|
47
|
+
chai_1.assert.equal(result, expectedResult);
|
|
48
|
+
}
|
|
49
|
+
async retrieveAllInputBatches__GetRequestCreatedForCorrectPath() {
|
|
50
|
+
this.mockedRequestSender.setup(_ => _.sendAndExtractBody(typemoq_1.It.isAny())).returns(() => ({}));
|
|
51
|
+
await this.testInstance.retrieveAllInputBatches();
|
|
52
|
+
this.mockedTestInstance.verify(_ => _["createGetRequest"]("/input-batches"), typemoq_1.Times.once());
|
|
53
|
+
}
|
|
54
|
+
async retrieveAllInputBatches__RequestSent() {
|
|
55
|
+
this.mockedRequestSender.setup(_ => _.sendAndExtractBody(typemoq_1.It.isAny())).returns(() => ({}));
|
|
56
|
+
await this.testInstance.retrieveAllInputBatches();
|
|
57
|
+
this.mockedRequestSender.verify(_ => _.sendAndExtractBody(this.request), typemoq_1.Times.once());
|
|
58
|
+
}
|
|
59
|
+
async retrieveAllInputBatches__InputBatchesProvided() {
|
|
60
|
+
const inputBatches = "SomeInputBatches";
|
|
61
|
+
const retrieveInputBatchesResult = new __1.RetrieveInputBatchesResult(inputBatches);
|
|
62
|
+
this.mockedRequestSender.setup(_ => _.sendAndExtractBody(typemoq_1.It.isAny())).returns(async () => retrieveInputBatchesResult);
|
|
63
|
+
const result = await this.testInstance.retrieveAllInputBatches();
|
|
64
|
+
chai_1.assert.equal(result, inputBatches);
|
|
65
|
+
}
|
|
66
|
+
async approveInputBatch__PostRequestCreatedForCorrectPath() {
|
|
67
|
+
await this.testInstance.approveInputBatch(typemoq_1.It.isAny());
|
|
68
|
+
this.mockedTestInstance.verify(_ => _["createPostRequest"]("/input-batch/approve"), typemoq_1.Times.once());
|
|
69
|
+
}
|
|
70
|
+
async approveInputBatch__InputBatchIdentitySpecified() {
|
|
71
|
+
const inputBatchIdentity = "InputBatchIdentity";
|
|
72
|
+
await this.testInstance.approveInputBatch(inputBatchIdentity);
|
|
73
|
+
this.mockedRequest.verify(_ => _.send(typemoq_1.It.isObjectWith({ inputBatchIdentity: inputBatchIdentity })), typemoq_1.Times.once());
|
|
74
|
+
}
|
|
75
|
+
async approveInputBatch__RequestSent() {
|
|
76
|
+
let awaited = false;
|
|
77
|
+
this.mockedRequestSender.setup(_ => _.send(typemoq_1.It.isAny()))
|
|
78
|
+
.returns(async () => {
|
|
79
|
+
awaited = true;
|
|
80
|
+
return {};
|
|
81
|
+
});
|
|
82
|
+
;
|
|
83
|
+
await this.testInstance.approveInputBatch(typemoq_1.It.isAny());
|
|
84
|
+
this.mockedRequestSender.verify(_ => _.send(this.request), typemoq_1.Times.once());
|
|
85
|
+
chai_1.assert.isTrue(awaited);
|
|
86
|
+
}
|
|
87
|
+
async discardInputBatch__PostRequestCreatedForCorrectPath() {
|
|
88
|
+
await this.testInstance.discardInputBatch(typemoq_1.It.isAny());
|
|
89
|
+
this.mockedTestInstance.verify(_ => _["createPostRequest"]("/input-batch/discard"), typemoq_1.Times.once());
|
|
90
|
+
}
|
|
91
|
+
async discardInputBatch__InputBatchIdentitySpecified() {
|
|
92
|
+
const inputBatchIdentity = "InputBatchIdentity";
|
|
93
|
+
await this.testInstance.discardInputBatch(inputBatchIdentity);
|
|
94
|
+
this.mockedRequest.verify(_ => _.send(typemoq_1.It.isObjectWith({ inputBatchIdentity: inputBatchIdentity })), typemoq_1.Times.once());
|
|
95
|
+
}
|
|
96
|
+
async discardInputBatch__RequestSent() {
|
|
97
|
+
let awaited = false;
|
|
98
|
+
this.mockedRequestSender.setup(_ => _.send(typemoq_1.It.isAny()))
|
|
99
|
+
.returns(async () => { awaited = true; return {}; });
|
|
100
|
+
await this.testInstance.discardInputBatch(typemoq_1.It.isAny());
|
|
101
|
+
this.mockedRequestSender.verify(_ => _.send(this.request), typemoq_1.Times.once());
|
|
102
|
+
chai_1.assert.isTrue(awaited);
|
|
103
|
+
}
|
|
104
|
+
createGetRequest__UrlCorrectlyBuilt() {
|
|
105
|
+
const { mockedTestInstance, testInstance } = this.createTestInstance();
|
|
106
|
+
const relativePath = "SomeRelativePath";
|
|
107
|
+
const url = "SomeUrl";
|
|
108
|
+
mockedTestInstance.setup(_ => _["buildUrl"](typemoq_1.It.isAny())).returns(() => url);
|
|
109
|
+
testInstance["createGetRequest"](relativePath);
|
|
110
|
+
mockedTestInstance.verify(_ => _["buildUrl"](relativePath), typemoq_1.Times.once());
|
|
111
|
+
}
|
|
112
|
+
createGetRequest__GetRequestCreatedAndProvided() {
|
|
113
|
+
const { mockedTestInstance, testInstance } = this.createTestInstance();
|
|
114
|
+
const url = "SomeUrl";
|
|
115
|
+
const request = "SomeRequest";
|
|
116
|
+
this.mockedSuperAgentRequestFactory.setup(_ => _.get(typemoq_1.It.isAny())).returns(() => request);
|
|
117
|
+
mockedTestInstance.setup(_ => _["buildUrl"](typemoq_1.It.isAny())).returns(() => url);
|
|
118
|
+
const result = testInstance["createGetRequest"]("");
|
|
119
|
+
chai_1.assert.equal(result, request);
|
|
120
|
+
this.mockedSuperAgentRequestFactory.verify(_ => _.get(url), typemoq_1.Times.once());
|
|
121
|
+
}
|
|
122
|
+
createPostRequest__UrlCorrectlyBuilt() {
|
|
123
|
+
const { mockedTestInstance, testInstance } = this.createTestInstance();
|
|
124
|
+
const relativePath = "SomeRelativePath";
|
|
125
|
+
const url = "SomeUrl";
|
|
126
|
+
mockedTestInstance.setup(_ => _["buildUrl"](typemoq_1.It.isAny())).returns(() => url);
|
|
127
|
+
testInstance["createPostRequest"](relativePath);
|
|
128
|
+
mockedTestInstance.verify(_ => _["buildUrl"](relativePath), typemoq_1.Times.once());
|
|
129
|
+
}
|
|
130
|
+
createPostRequest__PostRequestCreatedAndProvided() {
|
|
131
|
+
const { mockedTestInstance, testInstance } = this.createTestInstance();
|
|
132
|
+
const url = "SomeUrl";
|
|
133
|
+
const request = "SomeRequest";
|
|
134
|
+
this.mockedSuperAgentRequestFactory.setup(_ => _.post(typemoq_1.It.isAny())).returns(() => request);
|
|
135
|
+
mockedTestInstance.setup(_ => _["buildUrl"](typemoq_1.It.isAny())).returns(() => url);
|
|
136
|
+
const result = testInstance["createPostRequest"]("");
|
|
137
|
+
chai_1.assert.equal(result, request);
|
|
138
|
+
this.mockedSuperAgentRequestFactory.verify(_ => _.post(url), typemoq_1.Times.once());
|
|
139
|
+
}
|
|
140
|
+
async retrieveOrganisationsFromUser__GetRequestCreatedForCorrectPath() {
|
|
141
|
+
this.mockedRequestSender.setup(_ => _.sendAndExtractBody(typemoq_1.It.isAny())).returns(() => ({}));
|
|
142
|
+
await this.testInstance.retrieveOrganisationsFromUser();
|
|
143
|
+
this.mockedTestInstance.verify(_ => _["createGetRequest"]("/organisations-for-user"), typemoq_1.Times.once());
|
|
144
|
+
}
|
|
145
|
+
async retrieveOrganisationsFromUser__RequestSent() {
|
|
146
|
+
this.mockedRequestSender.setup(_ => _.sendAndExtractBody(typemoq_1.It.isAny())).returns(() => ({}));
|
|
147
|
+
await this.testInstance.retrieveOrganisationsFromUser();
|
|
148
|
+
this.mockedRequestSender.verify(_ => _.sendAndExtractBody(this.request), typemoq_1.Times.once());
|
|
149
|
+
}
|
|
150
|
+
async retrieveOrganisationsFromUser__InputBatchesProvided() {
|
|
151
|
+
const userId = "someUserId";
|
|
152
|
+
const organisations = "SomeOrganisations";
|
|
153
|
+
const organisationDto = new organisations_dto_1.OrganisationsDto(userId, organisations);
|
|
154
|
+
this.mockedRequestSender.setup(_ => _.sendAndExtractBody(typemoq_1.It.isAny())).returns(async () => organisationDto);
|
|
155
|
+
const result = await this.testInstance.retrieveOrganisationsFromUser();
|
|
156
|
+
chai_1.assert.deepEqual(result, organisationDto);
|
|
157
|
+
}
|
|
158
|
+
createTestInstance() {
|
|
159
|
+
const mockedTestInstance = typemoq_1.Mock.ofType(__1.LurchClient);
|
|
160
|
+
const testInstance = mockedTestInstance.object;
|
|
161
|
+
mockedTestInstance.callBase = true;
|
|
162
|
+
mockedTestInstance.setup(_ => _["superAgentRequestFactory"]).returns(() => this.superAgentRequestFactory);
|
|
163
|
+
mockedTestInstance.setup(_ => _["requestSender"]).returns(() => this.requestSender);
|
|
164
|
+
return { mockedTestInstance, testInstance };
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
__decorate([
|
|
168
|
+
mocha_1.test,
|
|
169
|
+
__metadata("design:type", Function),
|
|
170
|
+
__metadata("design:paramtypes", []),
|
|
171
|
+
__metadata("design:returntype", void 0)
|
|
172
|
+
], LurchClientTest.prototype, "buildUrl__RelativePathConcatenatedToBaseUrl", null);
|
|
173
|
+
__decorate([
|
|
174
|
+
mocha_1.test,
|
|
175
|
+
__metadata("design:type", Function),
|
|
176
|
+
__metadata("design:paramtypes", []),
|
|
177
|
+
__metadata("design:returntype", Promise)
|
|
178
|
+
], LurchClientTest.prototype, "retrieveAllInputBatches__GetRequestCreatedForCorrectPath", null);
|
|
179
|
+
__decorate([
|
|
180
|
+
mocha_1.test,
|
|
181
|
+
__metadata("design:type", Function),
|
|
182
|
+
__metadata("design:paramtypes", []),
|
|
183
|
+
__metadata("design:returntype", Promise)
|
|
184
|
+
], LurchClientTest.prototype, "retrieveAllInputBatches__RequestSent", null);
|
|
185
|
+
__decorate([
|
|
186
|
+
mocha_1.test,
|
|
187
|
+
__metadata("design:type", Function),
|
|
188
|
+
__metadata("design:paramtypes", []),
|
|
189
|
+
__metadata("design:returntype", Promise)
|
|
190
|
+
], LurchClientTest.prototype, "retrieveAllInputBatches__InputBatchesProvided", null);
|
|
191
|
+
__decorate([
|
|
192
|
+
mocha_1.test,
|
|
193
|
+
__metadata("design:type", Function),
|
|
194
|
+
__metadata("design:paramtypes", []),
|
|
195
|
+
__metadata("design:returntype", Promise)
|
|
196
|
+
], LurchClientTest.prototype, "approveInputBatch__PostRequestCreatedForCorrectPath", null);
|
|
197
|
+
__decorate([
|
|
198
|
+
mocha_1.test,
|
|
199
|
+
__metadata("design:type", Function),
|
|
200
|
+
__metadata("design:paramtypes", []),
|
|
201
|
+
__metadata("design:returntype", Promise)
|
|
202
|
+
], LurchClientTest.prototype, "approveInputBatch__InputBatchIdentitySpecified", null);
|
|
203
|
+
__decorate([
|
|
204
|
+
mocha_1.test,
|
|
205
|
+
__metadata("design:type", Function),
|
|
206
|
+
__metadata("design:paramtypes", []),
|
|
207
|
+
__metadata("design:returntype", Promise)
|
|
208
|
+
], LurchClientTest.prototype, "approveInputBatch__RequestSent", null);
|
|
209
|
+
__decorate([
|
|
210
|
+
mocha_1.test,
|
|
211
|
+
__metadata("design:type", Function),
|
|
212
|
+
__metadata("design:paramtypes", []),
|
|
213
|
+
__metadata("design:returntype", Promise)
|
|
214
|
+
], LurchClientTest.prototype, "discardInputBatch__PostRequestCreatedForCorrectPath", null);
|
|
215
|
+
__decorate([
|
|
216
|
+
mocha_1.test,
|
|
217
|
+
__metadata("design:type", Function),
|
|
218
|
+
__metadata("design:paramtypes", []),
|
|
219
|
+
__metadata("design:returntype", Promise)
|
|
220
|
+
], LurchClientTest.prototype, "discardInputBatch__InputBatchIdentitySpecified", null);
|
|
221
|
+
__decorate([
|
|
222
|
+
mocha_1.test,
|
|
223
|
+
__metadata("design:type", Function),
|
|
224
|
+
__metadata("design:paramtypes", []),
|
|
225
|
+
__metadata("design:returntype", Promise)
|
|
226
|
+
], LurchClientTest.prototype, "discardInputBatch__RequestSent", null);
|
|
227
|
+
__decorate([
|
|
228
|
+
mocha_1.test,
|
|
229
|
+
__metadata("design:type", Function),
|
|
230
|
+
__metadata("design:paramtypes", []),
|
|
231
|
+
__metadata("design:returntype", void 0)
|
|
232
|
+
], LurchClientTest.prototype, "createGetRequest__UrlCorrectlyBuilt", null);
|
|
233
|
+
__decorate([
|
|
234
|
+
mocha_1.test,
|
|
235
|
+
__metadata("design:type", Function),
|
|
236
|
+
__metadata("design:paramtypes", []),
|
|
237
|
+
__metadata("design:returntype", void 0)
|
|
238
|
+
], LurchClientTest.prototype, "createGetRequest__GetRequestCreatedAndProvided", null);
|
|
239
|
+
__decorate([
|
|
240
|
+
mocha_1.test,
|
|
241
|
+
__metadata("design:type", Function),
|
|
242
|
+
__metadata("design:paramtypes", []),
|
|
243
|
+
__metadata("design:returntype", void 0)
|
|
244
|
+
], LurchClientTest.prototype, "createPostRequest__UrlCorrectlyBuilt", null);
|
|
245
|
+
__decorate([
|
|
246
|
+
mocha_1.test,
|
|
247
|
+
__metadata("design:type", Function),
|
|
248
|
+
__metadata("design:paramtypes", []),
|
|
249
|
+
__metadata("design:returntype", void 0)
|
|
250
|
+
], LurchClientTest.prototype, "createPostRequest__PostRequestCreatedAndProvided", null);
|
|
251
|
+
__decorate([
|
|
252
|
+
mocha_1.test,
|
|
253
|
+
__metadata("design:type", Function),
|
|
254
|
+
__metadata("design:paramtypes", []),
|
|
255
|
+
__metadata("design:returntype", Promise)
|
|
256
|
+
], LurchClientTest.prototype, "retrieveOrganisationsFromUser__GetRequestCreatedForCorrectPath", null);
|
|
257
|
+
__decorate([
|
|
258
|
+
mocha_1.test,
|
|
259
|
+
__metadata("design:type", Function),
|
|
260
|
+
__metadata("design:paramtypes", []),
|
|
261
|
+
__metadata("design:returntype", Promise)
|
|
262
|
+
], LurchClientTest.prototype, "retrieveOrganisationsFromUser__RequestSent", null);
|
|
263
|
+
__decorate([
|
|
264
|
+
mocha_1.test,
|
|
265
|
+
__metadata("design:type", Function),
|
|
266
|
+
__metadata("design:paramtypes", []),
|
|
267
|
+
__metadata("design:returntype", Promise)
|
|
268
|
+
], LurchClientTest.prototype, "retrieveOrganisationsFromUser__InputBatchesProvided", null);
|
|
269
|
+
LurchClientTest = __decorate([
|
|
270
|
+
mocha_1.suite
|
|
271
|
+
], LurchClientTest);
|
|
303
272
|
//# sourceMappingURL=lurch-client.test.js.map
|