@unite-us/app-create-referral 0.15.58 → 0.15.59-CL-2024.2
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/hooks/__tests__/useCreateReferrals.test.js +201 -227
- package/dist/hooks/__tests__/useCreateReferrals.test.js.map +1 -1
- package/dist/hooks/useCreateReferrals.js +85 -77
- package/dist/hooks/useCreateReferrals.js.map +1 -1
- package/dist/pages/review/Review.js +20 -10
- package/dist/pages/review/Review.js.map +1 -1
- package/dist/utils/referralToConsent.js +72 -31
- package/dist/utils/referralToConsent.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,11 @@ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try {
|
|
|
10
10
|
function _OverloadYield(e, d) { this.v = e, this.k = d; }
|
|
11
11
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
12
12
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
18
|
import { renderHook, act } from '@testing-library/react-hooks';
|
|
14
19
|
import useCreateReferrals from '../useCreateReferrals';
|
|
15
20
|
import { useAppCreateReferralContext } from '../../context/AppCreateReferralProvider';
|
|
@@ -25,6 +30,17 @@ jest.mock('../../api/ApiHooks', function () {
|
|
|
25
30
|
useUpdateRecord: jest.fn()
|
|
26
31
|
};
|
|
27
32
|
});
|
|
33
|
+
jest.mock('../../api/config', function () {
|
|
34
|
+
return {
|
|
35
|
+
coreApi: {
|
|
36
|
+
populateRelationship: jest.fn(),
|
|
37
|
+
setRelationship: jest.fn(),
|
|
38
|
+
query: jest.fn(),
|
|
39
|
+
uploadFile: jest.fn()
|
|
40
|
+
},
|
|
41
|
+
CALLBACKS: {}
|
|
42
|
+
};
|
|
43
|
+
});
|
|
28
44
|
var referrals = [{
|
|
29
45
|
attachments: null,
|
|
30
46
|
case: undefined,
|
|
@@ -47,7 +63,10 @@ var referrals = [{
|
|
|
47
63
|
id: 'provider2'
|
|
48
64
|
},
|
|
49
65
|
network: {
|
|
50
|
-
id: 'network1'
|
|
66
|
+
id: 'network1',
|
|
67
|
+
features: {
|
|
68
|
+
nh_consent: true
|
|
69
|
+
}
|
|
51
70
|
},
|
|
52
71
|
service: {
|
|
53
72
|
id: 'service1'
|
|
@@ -57,6 +76,73 @@ var referrals = [{
|
|
|
57
76
|
}
|
|
58
77
|
}];
|
|
59
78
|
describe('useCreateReferrals', function () {
|
|
79
|
+
var createBaseReferral = function createBaseReferral() {
|
|
80
|
+
var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
81
|
+
return _objectSpread({
|
|
82
|
+
attachments: null,
|
|
83
|
+
case: undefined,
|
|
84
|
+
id: undefined,
|
|
85
|
+
state: undefined,
|
|
86
|
+
paymentAuthForm: {
|
|
87
|
+
amount_requested: null,
|
|
88
|
+
service_start: null,
|
|
89
|
+
service_end: null
|
|
90
|
+
},
|
|
91
|
+
programs: [{
|
|
92
|
+
id: 'program1',
|
|
93
|
+
provider: {
|
|
94
|
+
id: 'provider1',
|
|
95
|
+
licensed: true
|
|
96
|
+
}
|
|
97
|
+
}],
|
|
98
|
+
sendingProvider: {
|
|
99
|
+
id: 'provider2'
|
|
100
|
+
},
|
|
101
|
+
network: {
|
|
102
|
+
id: 'network1',
|
|
103
|
+
features: {
|
|
104
|
+
nh_consent: true
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
service: {
|
|
108
|
+
id: 'service1'
|
|
109
|
+
},
|
|
110
|
+
primaryWorker: {
|
|
111
|
+
id: "primary-worker-id"
|
|
112
|
+
}
|
|
113
|
+
}, overrides);
|
|
114
|
+
};
|
|
115
|
+
var setupMocks = function setupMocks(referrals) {
|
|
116
|
+
useAppCreateReferralContext.mockReturnValue({
|
|
117
|
+
state: {
|
|
118
|
+
currentEmployee: {
|
|
119
|
+
id: 'employee1'
|
|
120
|
+
},
|
|
121
|
+
formResponses: [],
|
|
122
|
+
person: {
|
|
123
|
+
id: 'person1'
|
|
124
|
+
},
|
|
125
|
+
referrals: referrals,
|
|
126
|
+
formSubmissionId: null,
|
|
127
|
+
assistanceRequestId: null,
|
|
128
|
+
screeningId: null
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
useCreateRecord.mockReturnValue({
|
|
132
|
+
createRecord: jest.fn().mockResolvedValue({
|
|
133
|
+
data: {
|
|
134
|
+
data: {}
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
useUpdateRecord.mockReturnValue({
|
|
139
|
+
updateRecord: jest.fn().mockResolvedValue({
|
|
140
|
+
data: {
|
|
141
|
+
data: {}
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
};
|
|
60
146
|
it('should validate response structure no matters the result', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
61
147
|
var _renderHook, result;
|
|
62
148
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -225,7 +311,6 @@ describe('useCreateReferrals', function () {
|
|
|
225
311
|
error: null
|
|
226
312
|
}],
|
|
227
313
|
referralsToConsent: [{
|
|
228
|
-
receivingProviderNames: ['Unknown Program'],
|
|
229
314
|
programNames: ['Unknown Program'],
|
|
230
315
|
referrals: ['referral1'],
|
|
231
316
|
serviceName: 'Unknown Service'
|
|
@@ -243,51 +328,46 @@ describe('useCreateReferrals', function () {
|
|
|
243
328
|
}
|
|
244
329
|
}, _callee4);
|
|
245
330
|
})));
|
|
331
|
+
var setupCreateRecordMocks = function setupCreateRecordMocks() {
|
|
332
|
+
var mockCreateCase = jest.fn().mockResolvedValue({
|
|
333
|
+
data: {
|
|
334
|
+
data: {
|
|
335
|
+
id: 'case1',
|
|
336
|
+
description: 'Test Case'
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
var mockCreateReferral = jest.fn().mockResolvedValue({
|
|
341
|
+
data: {
|
|
342
|
+
data: {
|
|
343
|
+
id: 'referral1',
|
|
344
|
+
state: 'sent'
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
useCreateRecord.mockImplementation(function (type) {
|
|
349
|
+
if (type === 'case') {
|
|
350
|
+
return {
|
|
351
|
+
createRecord: mockCreateCase
|
|
352
|
+
};
|
|
353
|
+
} else if (type === 'referral') {
|
|
354
|
+
return {
|
|
355
|
+
createRecord: mockCreateReferral
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
createRecord: jest.fn()
|
|
360
|
+
};
|
|
361
|
+
});
|
|
362
|
+
};
|
|
246
363
|
it('should create SOME referrals', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
247
|
-
var someReferrals,
|
|
364
|
+
var someReferrals, _renderHook3, result;
|
|
248
365
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
249
366
|
while (1) switch (_context6.prev = _context6.next) {
|
|
250
367
|
case 0:
|
|
251
|
-
someReferrals = [{
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
id: undefined,
|
|
255
|
-
state: undefined,
|
|
256
|
-
paymentAuthForm: {
|
|
257
|
-
amount_requested: null,
|
|
258
|
-
service_start: null,
|
|
259
|
-
service_end: null
|
|
260
|
-
},
|
|
261
|
-
description: 'Test Referral',
|
|
262
|
-
programs: [{
|
|
263
|
-
id: 'program1',
|
|
264
|
-
provider: {
|
|
265
|
-
id: 'provider1',
|
|
266
|
-
licensed: true
|
|
267
|
-
}
|
|
268
|
-
}],
|
|
269
|
-
sendingProvider: {
|
|
270
|
-
id: 'provider2'
|
|
271
|
-
},
|
|
272
|
-
network: {
|
|
273
|
-
id: 'network1'
|
|
274
|
-
},
|
|
275
|
-
service: {
|
|
276
|
-
id: 'service1'
|
|
277
|
-
},
|
|
278
|
-
primaryWorker: {
|
|
279
|
-
id: "primary-worker-id"
|
|
280
|
-
}
|
|
281
|
-
}, {
|
|
282
|
-
attachments: null,
|
|
283
|
-
case: undefined,
|
|
284
|
-
id: undefined,
|
|
285
|
-
state: undefined,
|
|
286
|
-
paymentAuthForm: {
|
|
287
|
-
amount_requested: null,
|
|
288
|
-
service_start: null,
|
|
289
|
-
service_end: null
|
|
290
|
-
},
|
|
368
|
+
someReferrals = [createBaseReferral({
|
|
369
|
+
description: 'Test Referral'
|
|
370
|
+
}), createBaseReferral({
|
|
291
371
|
description: null,
|
|
292
372
|
programs: [{
|
|
293
373
|
id: 'program2',
|
|
@@ -296,82 +376,16 @@ describe('useCreateReferrals', function () {
|
|
|
296
376
|
licensed: true
|
|
297
377
|
}
|
|
298
378
|
}],
|
|
299
|
-
sendingProvider: {
|
|
300
|
-
id: 'provider2'
|
|
301
|
-
},
|
|
302
|
-
network: {
|
|
303
|
-
id: 'network1'
|
|
304
|
-
},
|
|
305
379
|
service: {
|
|
306
380
|
id: 'service2'
|
|
307
|
-
},
|
|
308
|
-
primaryWorker: {
|
|
309
|
-
id: "primary-worker-id"
|
|
310
381
|
}
|
|
311
|
-
}];
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
currentEmployee: {
|
|
315
|
-
id: 'employee1'
|
|
316
|
-
},
|
|
317
|
-
formResponses: [],
|
|
318
|
-
person: {
|
|
319
|
-
id: 'person1'
|
|
320
|
-
},
|
|
321
|
-
referrals: someReferrals,
|
|
322
|
-
formSubmissionId: null,
|
|
323
|
-
assistanceRequestId: null,
|
|
324
|
-
screeningId: null
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
useCreateRecord.mockReturnValue({
|
|
328
|
-
createRecord: jest.fn().mockResolvedValue({
|
|
329
|
-
data: {
|
|
330
|
-
data: {}
|
|
331
|
-
}
|
|
332
|
-
})
|
|
333
|
-
});
|
|
334
|
-
useUpdateRecord.mockReturnValue({
|
|
335
|
-
updateRecord: jest.fn().mockResolvedValue({
|
|
336
|
-
data: {
|
|
337
|
-
data: {}
|
|
338
|
-
}
|
|
339
|
-
})
|
|
340
|
-
});
|
|
341
|
-
mockCreateCase = jest.fn().mockResolvedValue({
|
|
342
|
-
data: {
|
|
343
|
-
data: {
|
|
344
|
-
id: 'case1',
|
|
345
|
-
description: 'Test Case'
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
mockCreateReferral = jest.fn().mockResolvedValue({
|
|
350
|
-
data: {
|
|
351
|
-
data: {
|
|
352
|
-
id: 'referral1',
|
|
353
|
-
state: 'sent'
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
useCreateRecord.mockImplementation(function (type) {
|
|
358
|
-
if (type === 'case') {
|
|
359
|
-
return {
|
|
360
|
-
createRecord: mockCreateCase
|
|
361
|
-
};
|
|
362
|
-
} else if (type === 'referral') {
|
|
363
|
-
return {
|
|
364
|
-
createRecord: mockCreateReferral
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
return {
|
|
368
|
-
createRecord: jest.fn()
|
|
369
|
-
};
|
|
370
|
-
});
|
|
382
|
+
})];
|
|
383
|
+
setupMocks(someReferrals);
|
|
384
|
+
setupCreateRecordMocks();
|
|
371
385
|
_renderHook3 = renderHook(function () {
|
|
372
386
|
return useCreateReferrals();
|
|
373
387
|
}), result = _renderHook3.result;
|
|
374
|
-
_context6.next =
|
|
388
|
+
_context6.next = 6;
|
|
375
389
|
return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
376
390
|
var createReferrals, response;
|
|
377
391
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
@@ -407,7 +421,6 @@ describe('useCreateReferrals', function () {
|
|
|
407
421
|
error: 'Unexpected error: The following fields for the case are required: description'
|
|
408
422
|
}],
|
|
409
423
|
referralsToConsent: [{
|
|
410
|
-
receivingProviderNames: ['Unknown Program'],
|
|
411
424
|
programNames: ['Unknown Program'],
|
|
412
425
|
referrals: ['referral1'],
|
|
413
426
|
serviceName: 'Unknown Service'
|
|
@@ -419,57 +432,20 @@ describe('useCreateReferrals', function () {
|
|
|
419
432
|
}
|
|
420
433
|
}, _callee5);
|
|
421
434
|
})));
|
|
422
|
-
case
|
|
435
|
+
case 6:
|
|
423
436
|
case "end":
|
|
424
437
|
return _context6.stop();
|
|
425
438
|
}
|
|
426
439
|
}, _callee6);
|
|
427
440
|
})));
|
|
428
441
|
it('should FAIL all referrals', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
429
|
-
var referralsFailed,
|
|
442
|
+
var referralsFailed, _renderHook4, result;
|
|
430
443
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
431
444
|
while (1) switch (_context8.prev = _context8.next) {
|
|
432
445
|
case 0:
|
|
433
|
-
referralsFailed = [{
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
id: undefined,
|
|
437
|
-
state: undefined,
|
|
438
|
-
paymentAuthForm: {
|
|
439
|
-
amount_requested: null,
|
|
440
|
-
service_start: null,
|
|
441
|
-
service_end: null
|
|
442
|
-
},
|
|
443
|
-
description: null,
|
|
444
|
-
programs: [{
|
|
445
|
-
id: 'program1',
|
|
446
|
-
provider: {
|
|
447
|
-
id: 'provider1',
|
|
448
|
-
licensed: true
|
|
449
|
-
}
|
|
450
|
-
}],
|
|
451
|
-
sendingProvider: {
|
|
452
|
-
id: 'provider2'
|
|
453
|
-
},
|
|
454
|
-
network: {
|
|
455
|
-
id: 'network1'
|
|
456
|
-
},
|
|
457
|
-
service: {
|
|
458
|
-
id: 'service1'
|
|
459
|
-
},
|
|
460
|
-
primaryWorker: {
|
|
461
|
-
id: "primary-worker-id"
|
|
462
|
-
}
|
|
463
|
-
}, {
|
|
464
|
-
attachments: null,
|
|
465
|
-
case: undefined,
|
|
466
|
-
id: undefined,
|
|
467
|
-
state: undefined,
|
|
468
|
-
paymentAuthForm: {
|
|
469
|
-
amount_requested: null,
|
|
470
|
-
service_start: null,
|
|
471
|
-
service_end: null
|
|
472
|
-
},
|
|
446
|
+
referralsFailed = [createBaseReferral({
|
|
447
|
+
description: null
|
|
448
|
+
}), createBaseReferral({
|
|
473
449
|
description: null,
|
|
474
450
|
programs: [{
|
|
475
451
|
id: 'program2',
|
|
@@ -478,82 +454,16 @@ describe('useCreateReferrals', function () {
|
|
|
478
454
|
licensed: true
|
|
479
455
|
}
|
|
480
456
|
}],
|
|
481
|
-
sendingProvider: {
|
|
482
|
-
id: 'provider2'
|
|
483
|
-
},
|
|
484
|
-
network: {
|
|
485
|
-
id: 'network1'
|
|
486
|
-
},
|
|
487
457
|
service: {
|
|
488
458
|
id: 'service2'
|
|
489
|
-
},
|
|
490
|
-
primaryWorker: {
|
|
491
|
-
id: "primary-worker-id"
|
|
492
459
|
}
|
|
493
|
-
}];
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
currentEmployee: {
|
|
497
|
-
id: 'employee1'
|
|
498
|
-
},
|
|
499
|
-
formResponses: [],
|
|
500
|
-
person: {
|
|
501
|
-
id: 'person1'
|
|
502
|
-
},
|
|
503
|
-
referrals: referralsFailed,
|
|
504
|
-
formSubmissionId: null,
|
|
505
|
-
assistanceRequestId: null,
|
|
506
|
-
screeningId: null
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
useCreateRecord.mockReturnValue({
|
|
510
|
-
createRecord: jest.fn().mockResolvedValue({
|
|
511
|
-
data: {
|
|
512
|
-
data: {}
|
|
513
|
-
}
|
|
514
|
-
})
|
|
515
|
-
});
|
|
516
|
-
useUpdateRecord.mockReturnValue({
|
|
517
|
-
updateRecord: jest.fn().mockResolvedValue({
|
|
518
|
-
data: {
|
|
519
|
-
data: {}
|
|
520
|
-
}
|
|
521
|
-
})
|
|
522
|
-
});
|
|
523
|
-
mockCreateCase = jest.fn().mockResolvedValue({
|
|
524
|
-
data: {
|
|
525
|
-
data: {
|
|
526
|
-
id: 'case1',
|
|
527
|
-
description: 'Test Case'
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
mockCreateReferral = jest.fn().mockResolvedValue({
|
|
532
|
-
data: {
|
|
533
|
-
data: {
|
|
534
|
-
id: 'referral1',
|
|
535
|
-
state: 'sent'
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
useCreateRecord.mockImplementation(function (type) {
|
|
540
|
-
if (type === 'case') {
|
|
541
|
-
return {
|
|
542
|
-
createRecord: mockCreateCase
|
|
543
|
-
};
|
|
544
|
-
} else if (type === 'referral') {
|
|
545
|
-
return {
|
|
546
|
-
createRecord: mockCreateReferral
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
return {
|
|
550
|
-
createRecord: jest.fn()
|
|
551
|
-
};
|
|
552
|
-
});
|
|
460
|
+
})];
|
|
461
|
+
setupMocks(referralsFailed);
|
|
462
|
+
setupCreateRecordMocks();
|
|
553
463
|
_renderHook4 = renderHook(function () {
|
|
554
464
|
return useCreateReferrals();
|
|
555
465
|
}), result = _renderHook4.result;
|
|
556
|
-
_context8.next =
|
|
466
|
+
_context8.next = 6;
|
|
557
467
|
return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
558
468
|
var createReferrals, response;
|
|
559
469
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
@@ -590,11 +500,75 @@ describe('useCreateReferrals', function () {
|
|
|
590
500
|
}
|
|
591
501
|
}, _callee7);
|
|
592
502
|
})));
|
|
593
|
-
case
|
|
503
|
+
case 6:
|
|
594
504
|
case "end":
|
|
595
505
|
return _context8.stop();
|
|
596
506
|
}
|
|
597
507
|
}, _callee8);
|
|
598
508
|
})));
|
|
509
|
+
it('should not create referrals to consent when nh_consent is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
510
|
+
var referrals, _renderHook5, result;
|
|
511
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
512
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
513
|
+
case 0:
|
|
514
|
+
referrals = [createBaseReferral({
|
|
515
|
+
description: 'Test Referral',
|
|
516
|
+
network: {
|
|
517
|
+
id: 'network1',
|
|
518
|
+
features: {
|
|
519
|
+
nh_consent: false
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
})];
|
|
523
|
+
setupMocks(referrals);
|
|
524
|
+
setupCreateRecordMocks();
|
|
525
|
+
_renderHook5 = renderHook(function () {
|
|
526
|
+
return useCreateReferrals();
|
|
527
|
+
}), result = _renderHook5.result;
|
|
528
|
+
_context10.next = 6;
|
|
529
|
+
return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
530
|
+
var createReferrals, response;
|
|
531
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
532
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
533
|
+
case 0:
|
|
534
|
+
createReferrals = result.current;
|
|
535
|
+
_context9.next = 3;
|
|
536
|
+
return createReferrals({
|
|
537
|
+
referrals: referrals,
|
|
538
|
+
person: {
|
|
539
|
+
id: 'person1'
|
|
540
|
+
},
|
|
541
|
+
draft: false
|
|
542
|
+
});
|
|
543
|
+
case 3:
|
|
544
|
+
response = _context9.sent;
|
|
545
|
+
expect(response).toEqual({
|
|
546
|
+
cases: [{
|
|
547
|
+
id: 'case1',
|
|
548
|
+
description: 'Test Case'
|
|
549
|
+
}],
|
|
550
|
+
referrals: [{
|
|
551
|
+
id: 'referral1',
|
|
552
|
+
state: 'sent'
|
|
553
|
+
}],
|
|
554
|
+
shippingDetail: [{
|
|
555
|
+
index: 0,
|
|
556
|
+
sent: true,
|
|
557
|
+
error: null
|
|
558
|
+
}],
|
|
559
|
+
referralsToConsent: []
|
|
560
|
+
});
|
|
561
|
+
case 5:
|
|
562
|
+
case "end":
|
|
563
|
+
return _context9.stop();
|
|
564
|
+
}
|
|
565
|
+
}, _callee9);
|
|
566
|
+
})));
|
|
567
|
+
case 6:
|
|
568
|
+
case "end":
|
|
569
|
+
return _context10.stop();
|
|
570
|
+
}
|
|
571
|
+
}, _callee10);
|
|
572
|
+
})));
|
|
599
573
|
});
|
|
600
574
|
//# sourceMappingURL=useCreateReferrals.test.js.map
|