Produced by Araxis Merge on 4/18/2019 5:55:17 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_API_Core\src\test\fsc-837\Backup121218 | endpoint-fsc-837-djh.js | Wed Apr 3 02:27:36 2019 UTC |
2 | MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_API_Core\src\test\fsc-837\Backup121218 | endpoint-fsc-837-djh.js | Mon Apr 15 17:59:44 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 7 | 804 |
Changed | 6 | 12 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | "use stric t" | |
2 | ||
3 | const debu g = requir e('debug') ('test') | |
4 | ||
5 | const $tas = require ('../../ta s')() | |
6 | const busi ness = req uire('../. ./app/fsc/ 837/busine ss') | |
7 | const { | |
8 | app, | |
9 | chai | |
10 | } = $tas.c haiTest() | |
11 | const expe ct = chai. expect | |
12 | const shou ld = chai. should() | |
13 | const util = require ('util') | |
14 | ||
15 | ||
16 | let nock | |
17 | try { | |
18 | nock = require(' nock') | |
19 | } catch (e x) {} | |
20 | ||
21 | let mock_c laim = req uire('./mo ck-claim') | |
22 | ||
23 | /*** | |
24 | ||
25 | DJH 6/5/2 018 | |
26 | ||
27 | Ensure th at TAS_ENA BLE_HTTP i s set in e nvironment , setting it in code will not work | |
28 | process.e nv.TAS_ENA BLE_HTTP = true | |
29 | ||
30 | */ | |
31 | ||
32 | //if (nock && $tas.c onfig.ENAB LE_HTTP == = true) { | |
33 | ||
34 | describe(" regex", fu nction () { | |
35 | it("re gex", func tion (done ) { | |
36 | co nst regex = /(\d+\|) (\d+)(.*)/ gm | |
37 | co nst str = `681|391^P N^681^USVH A|A` | |
38 | le t _new = s tr.replace (regex, "$ 1IBTAS,APP LICATION P ROXY$3") | |
39 | de bug(_new) | |
40 | do ne() | |
41 | }) | |
42 | }) | |
43 | ||
44 | ||
45 | ||
46 | describe(" tests writ e", functi on () { | |
47 | it("ca lls comman ds", async function () { | |
48 | co nst idgen = $tas.hel pers.idgen | |
49 | co nst obj = { | |
50 | a: 1, | |
51 | b: 2 | |
52 | } | |
53 | co nst name = idgen.gen erate('0') | |
54 | co nst $set = { | |
55 | [name]: obj | |
56 | } | |
57 | ||
58 | le t result = await $ta s.command. run('metab ase', 'dat a', 'save' , $set) | |
59 | ex pect(resul t.statuses ).to.conta in($tas.co nstants.st atus.NO_CO NTENT) | |
60 | ||
61 | re sult = awa it $tas.co mmand.run( 'metabase' , 'data', 'load', { | |
62 | names: n ame | |
63 | }) | |
64 | ex pect(resul t.data).to .eql($set) | |
65 | }).tim eout(10000 ) | |
66 | ||
67 | }) | |
68 | ||
69 | ||
70 | describe(" load test rabbitmq", function () { | |
71 | ||
72 | ||
73 | it("li stens / ad ds to queu e / waits (observabl e)", async () => { | |
74 | le t queues = [] | |
75 | co nst TEST_I D = +new D ate() | |
76 | co nst prefix QueueName = name => 'TEST_' + TEST_ID + name | |
77 | co nst queue_ name = pre fixQueueNa me($tas.he lpers.idge n.generate (this.titl e)) | |
78 | qu eues.push( queue_name ) | |
79 | co nst obj = { | |
80 | a: 1, | |
81 | b: 2 | |
82 | } | |
83 | le t complete d = {} | |
84 | ||
85 | tr y { | |
86 | await $t as.provide rs.amqp.co nnect(proc ess.env.TA S_QUEUE_AD DRESS) | |
87 | await $t as.provide rs.amqp.en sureSendCh annel(queu e_name) | |
88 | } catch (ex) { | |
89 | debug('a mqp::conne ct() faile d ' + util .inspect(e x)) | |
90 | } | |
91 | ||
92 | le t files = new Array( 100) | |
93 | fo r (let i = 0; i < 10 0; i++) { | |
94 | files.pu sh(obj) | |
95 | } | |
96 | le t n = 0 | |
97 | ||
98 | aw ait Promis e.all(file s.map(asyn c (file) = > { | |
99 | n = n++ | |
100 | await $t as.provide rs.amqp.se nd(queue_n ame, Objec t.assign({ }, obj, { | |
101 | n | |
102 | })) | |
103 | //debug( 'push comp lete') | |
104 | }) ) | |
105 | ||
106 | // await $ta s.helpers. process.wh en(() => O bject.keys (completed ).length < 100, () = > { | |
107 | // debug ('length', Object.ke ys(complet ed).length ) | |
108 | // }) | |
109 | aw ait $tas.p roviders.a mqp.close( ) | |
110 | }).tim eout(10000 000) | |
111 | ||
112 | }) | |
113 | ||
114 | describe(" POST /api/ fsc/v2/837 with nock - 1", fun ction () { | |
115 | before (() => { | |
116 | ap p.start() | |
117 | ||
118 | mo ck_claim.C ONFIG.vist aInstance = business .templateI nstanceHel per(null, 681) | |
119 | ||
120 | le t iens_url = busines s.TEMPLATE _fsc_837_i ens_url(mo ck_claim.C ONFIG) | |
121 | ||
122 | // N.B. You must have a respone for every request, s ince we ar e running two tests | |
123 | le t fhir_ser ver_claim_ response = nock(mock _claim.CON FIG.tasFHI REndpoint) | |
124 | .get(ien s_url) | |
125 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
126 | ||
127 | le t fhir_ser ver_claim_ response1 = nock(moc k_claim.CO NFIG.tasFH IREndpoint ) | |
128 | .get(bus iness.TEMP LATE_fsc_8 37_iens_ur l(mock_cla im.CONFIG) ) | |
129 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
130 | ||
131 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=681&_ id=2113071 " | |
132 | ||
133 | de bug('GET: ', busines s.TEMPLATE _fsc_837_b undle_url( mock_claim .CONFIG, 8 37, 211307 1)) | |
134 | le t fhir_ser ver_claim_ response_d etail1 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
135 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113071 ') | |
136 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 21 13071)) | |
137 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
138 | ||
139 | le t fhir_ser ver_claim_ response_d etail2 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
140 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113072 ') | |
141 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 21 13072)) | |
142 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
143 | ||
144 | ||
145 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=681&_ id=2113071 " | |
146 | le t fhir_ser ver_claim_ response_d etail3 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
147 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113071 ') | |
148 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 21 13071)) | |
149 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
150 | ||
151 | le t fhir_ser ver_claim_ response_d etail4 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
152 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113072 ') | |
153 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 21 13072)) | |
154 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
155 | ||
156 | ||
157 | de bug('PUT: ', busines s.TEMPLATE _fsc_837_w riteback_u rl(mock_cl aim.CONFIG , '837WB', 2113071)) | |
158 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
159 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113071 ') | |
160 | .put(bus iness.TEMP LATE_fsc_8 37_writeba ck_url(moc k_claim.CO NFIG, '837 WB', 21130 71)) | |
161 | .reply(2 00, { | |
162 | 'hap py': 'happ y joy joy' | |
163 | }) | |
164 | ||
165 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
166 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113072 ') | |
167 | .put(bus iness.TEMP LATE_fsc_8 37_writeba ck_url(moc k_claim.CO NFIG, '837 WB', 21130 72)) | |
168 | .reply(2 00, { | |
169 | 'hap py': 'happ y joy joy' | |
170 | }) | |
171 | ||
172 | }) | |
173 | after( () => { | |
174 | ap p.stop() | |
175 | no ck.cleanAl l() | |
176 | }) | |
177 | ||
178 | ||
179 | it("ha ppy path ( amqp avail able)", fu nction (do ne) { | |
180 | // let iamVis taIds = a wait $tas. command.ru n('metabas e','data', 'load',{na mes: 'vist aid,samAcc ountName'} ,{'secid': 'IBTAS,APP LICATION P ROXY'}) | |
181 | // debug(iamV istaIds) | |
182 | // done() | |
183 | ||
184 | th is.timeout (30000) | |
185 | ||
186 | le t testConf ig = Objec t.assign({ }, mock_cl aim.CONFIG ) | |
187 | te stConfig.d escription = "happy path (with amqp avai lable)" | |
188 | ||
189 | // N.B.! | |
190 | te stConfig.q ueueAddres s = proces s.env.TAS_ QUEUE_ADDR ESS | |
191 | ||
192 | // chai.requ est(DEV_SE RVER) | |
193 | ch ai.request (app.baseA ddress()) | |
194 | //chai.r equest('ht tp://local host:3000' ) | |
195 | .post('/ api/fsc/v2 ') | |
196 | ||
197 | .set('se cid', '_00 0011111') | |
198 | .send({ | |
199 | para ms: testCo nfig | |
200 | }) | |
201 | .end((er r, res) => { | |
202 | expe ct(res).to .have.stat us(200) | |
203 | let results = res.body | |
204 | // n ot sure wh y json is empty | |
205 | expe ct(results .iens.stat usCode).to .eq(200) | |
206 | done () | |
207 | }) | |
208 | }) | |
209 | }) | |
210 | ||
211 | describe(" POST /api/ fsc/v2/837 with nock - 2", fun ction () { | |
212 | before (() => { | |
213 | ap p.start() | |
214 | le t iens_url = busines s.TEMPLATE _fsc_837_i ens_url(mo ck_claim.C ONFIG) | |
215 | ||
216 | // N.B. You must have a respone for every request, s ince we ar e running two tests | |
217 | le t fhir_ser ver_claim_ response = nock(mock _claim.CON FIG.tasFHI REndpoint) | |
218 | .get(ien s_url) | |
219 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
220 | ||
221 | le t fhir_ser ver_claim_ response1 = nock(moc k_claim.CO NFIG.tasFH IREndpoint ) | |
222 | .get(bus iness.TEMP LATE_fsc_8 37_iens_ur l(mock_cla im.CONFIG) ) | |
223 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
224 | ||
225 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=681&_ id=2113071 " | |
226 | le t fhir_ser ver_claim_ response_d etail1 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
227 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113071 ') | |
228 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 21 13071)) | |
229 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
230 | ||
231 | le t fhir_ser ver_claim_ response_d etail2 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
232 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113072 ') | |
233 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 21 13072)) | |
234 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
235 | ||
236 | ||
237 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=681&_ id=2113071 " | |
238 | le t fhir_ser ver_claim_ response_d etail3 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
239 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113071 ') | |
240 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 21 13071)) | |
241 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
242 | ||
243 | le t fhir_ser ver_claim_ response_d etail4 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
244 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113072 ') | |
245 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 21 13072)) | |
246 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
247 | ||
248 | // | |
249 | // | |
250 | // | |
251 | ||
252 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
253 | .get(ien s_url) | |
254 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
255 | ||
256 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
257 | .get(bus iness.TEMP LATE_fsc_8 37_iens_ur l(mock_cla im.CONFIG) ) | |
258 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
259 | ||
260 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=681&_ id=2113071 " | |
261 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
262 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113071 ') | |
263 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 68 1, 2113071 )) | |
264 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
265 | ||
266 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
267 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113072 ') | |
268 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 68 1, 2113072 )) | |
269 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
270 | ||
271 | ||
272 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=681&_ id=2113071 " | |
273 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
274 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113071 ') | |
275 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 68 1, 2113071 )) | |
276 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
277 | ||
278 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
279 | //.get(' /Bundle?us e=837&loca tion=681&_ id=2113072 ') | |
280 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 68 1, 2113072 )) | |
281 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
282 | ||
283 | ||
284 | }) | |
285 | after( () => { | |
286 | ap p.stop() | |
287 | no ck.cleanAl l() | |
288 | }) | |
289 | ||
290 | ||
291 | // que ue not ava ilable | |
292 | it("ma lformed am qp uri", f unction (d one) { | |
293 | th is.timeout (14000) | |
294 | ||
295 | le t hold_TAS _QUEUE_ADD RESS = pro cess.env.T AS_QUEUE_A DDRESS | |
296 | pr ocess.env. TAS_QUEUE_ ADDRESS = "http://lo calhost" | |
297 | ||
298 | le t testConf ig = Objec t.assign({ }, mock_cl aim.CONFIG ) | |
299 | te stConfig.d escription = "malfor med amqp u ri" | |
300 | ||
301 | // chai.requ est(DEV_SE RVER) | |
302 | ch ai.request (app.baseA ddress()) | |
303 | //chai.r equest('ht tp://local host:3000' ) | |
304 | .post('/ api/fsc/v2 ') | |
305 | .set('se cid', 'MOC K-SECID-00 00011111') | |
306 | .send({ | |
307 | para ms: testCo nfig | |
308 | }) | |
309 | .end((er r, res) => { | |
310 | proc ess.env.TA S_QUEUE_AD DRESS = ho ld_TAS_QUE UE_ADDRESS | |
311 | expe ct(res).to .have.stat us(200) | |
312 | let results = res.body | |
313 | ||
314 | // e xpect the queue sect ion to hav e 500 stat us code | |
315 | expe ct(results .queue.sta tusCode).t o.eq(500) | |
316 | done () | |
317 | }) | |
318 | }) | |
319 | ||
320 | }) | |
321 | ||
322 | describe(" POST /api/ fsc/v2/837 with nock - 3", fun ction () { | |
323 | before (() => { | |
324 | ap p.start() | |
325 | }) | |
326 | after( () => { | |
327 | ap p.stop() | |
328 | }) | |
329 | ||
330 | // fir st getBund le() fails ; webclien t throws 4 04 | |
331 | it("ma lformed VA _FHIR_SERV ER uri", f unction (d one) { | |
332 | th is.timeout (14000) | |
333 | ||
334 | le t testConf ig = Objec t.assign({ }, mock_cl aim.CONFIG ) | |
335 | te stConfig.d escription = "malfor med VA_FHI R_SERVER u ri" | |
336 | te stConfig.t asFHIREndp oint = "ht tp://local host" | |
337 | // chai.requ est(DEV_SE RVER) | |
338 | ch ai.request (app.baseA ddress()) | |
339 | //chai.r equest('ht tp://local host:3000' ) | |
340 | .post('/ api/fsc/v2 ') | |
341 | ||
342 | .set('se cid', 'MOC K-SECID-00 00011111') | |
343 | .send({ | |
344 | para ms: testCo nfig | |
345 | }) | |
346 | .end((er r, res) => { | |
347 | ||
348 | // e xpect a ge neral exce ption | |
349 | expe ct(res).to .have.stat us(500) | |
350 | let results = res.body | |
351 | done () | |
352 | }) | |
353 | }) | |
354 | ||
355 | }) | |
356 | ||
357 | describe(" POST /api/ fsc/v2/837 with nock - 4", fun ction () { | |
358 | before (() => { | |
359 | ap p.start() | |
360 | le t iens_url = busines s.TEMPLATE _fsc_837_i ens_url(mo ck_claim.C ONFIG) | |
361 | ||
362 | // return 50 0 | |
363 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
364 | .get(bus iness.TEMP LATE_fsc_8 37_iens_ur l(mock_cla im.CONFIG) ) | |
365 | .reply(5 00, { | |
366 | mess age: 'moch aTest:malf ormed VA_F HIR_SERVER 500' | |
367 | }) | |
368 | ||
369 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
370 | .get(bus iness.TEMP LATE_fsc_8 37_iens_ur l(mock_cla im.CONFIG) ) | |
371 | .reply(5 00, { | |
372 | mess age: 'moch aTest:malf ormed VA_F HIR_SERVER 500' | |
373 | }) | |
374 | ||
375 | }) | |
376 | after( () => { | |
377 | ap p.stop() | |
378 | no ck.cleanAl l() | |
379 | }) | |
380 | ||
381 | ||
382 | // ien s 500 retu rned from NOCK | |
383 | // N.B . If you want to te st standlo ne, then y ou need to comment o ut the fir st two noc k response s above | |
384 | // fhi r_server_c laim_respo nse and fh ir_server_ claim_resp onse1 | |
385 | ||
386 | it("VA _FHIR_SERV ER 500", f unction (d one) { | |
387 | th is.timeout (14000) | |
388 | le t testConf ig = Objec t.assign({ }, mock_cl aim.CONFIG ) | |
389 | te stConfig.d escription = "VA_FHI R_SERVER 5 00" | |
390 | // chai.requ est(DEV_SE RVER) | |
391 | ch ai.request (app.baseA ddress()) | |
392 | //chai.r equest('ht tp://local host:3000' ) | |
393 | .post('/ api/fsc/v2 ') | |
394 | ||
395 | .set('se cid', 'MOC K-SECID-00 00011111') | |
396 | .send({ | |
397 | para ms: testCo nfig | |
398 | }) | |
399 | .end((er r, res) => { | |
400 | //sh ould.not.e xist(res.b ody.except ion) | |
401 | expe ct(res).to .have.stat us(500) | |
402 | let results = res.body | |
403 | expe ct(results .iens.stat usCode).to .eq(500) | |
404 | done () | |
405 | }) | |
406 | }) | |
407 | ||
408 | }) |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.