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