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\backup100118 | endpoint-fsc-837.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\backup100118 | endpoint-fsc-837.js | Mon Apr 15 17:59:44 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 7 | 586 |
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 | ||
14 | ||
15 | let nock | |
16 | try { | |
17 | nock = require(' nock') | |
18 | } catch (e x) {} | |
19 | ||
20 | let mock_c laim = req uire('./mo ck-claim') | |
21 | ||
22 | /*** | |
23 | ||
24 | DJH 6/5/2 018 | |
25 | ||
26 | Ensure th at TAS_ENA BLE_HTTP i s set in e nvironment , setting it in code will not work | |
27 | process.e nv.TAS_ENA BLE_HTTP = true | |
28 | ||
29 | */ | |
30 | ||
31 | //if (nock && $tas.c onfig.ENAB LE_HTTP == = true) { | |
32 | ||
33 | describe(" POST /api/ fsc/v2/837 with nock - 1", fun ction () { | |
34 | before (() => { | |
35 | ap p.start() | |
36 | le t iens_url = busines s.TEMPLATE _fsc_837_i ens_url(mo ck_claim.C ONFIG) | |
37 | ||
38 | // N.B. You must have a respone for every request, s ince we ar e running two tests | |
39 | le t fhir_ser ver_claim_ response = nock(mock _claim.CON FIG.tasFHI REndpoint) | |
40 | .get(ien s_url) | |
41 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
42 | ||
43 | let fhir_serv er_claim_r esponse1 = nock(mock _claim.CON FIG.tasFHI REndpoint) | |
44 | .get(bus iness.TEMP LATE_fsc_8 37_iens_ur l(mock_cla im.CONFIG) ) | |
45 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
46 | ||
47 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=442&_ id=2113071 " | |
48 | le t fhir_ser ver_claim_ response_d etail1 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
49 | //.get(' /Bundle?us e=837&loca tion=442&_ id=2113071 ') | |
50 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 44 2, 2113071 )) | |
51 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
52 | ||
53 | let fhir _server_cl aim_respon se_detail2 = nock(mo ck_claim.C ONFIG.tasF HIREndpoin t) | |
54 | //.get(' /Bundle?us e=837&loca tion=442&_ id=2113072 ') | |
55 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 44 2, 2113072 )) | |
56 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
57 | ||
58 | ||
59 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=442&_ id=2113071 " | |
60 | le t fhir_ser ver_claim_ response_d etail3 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
61 | //.get(' /Bundle?us e=837&loca tion=442&_ id=2113071 ') | |
62 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 44 2, 2113071 )) | |
63 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
64 | ||
65 | le t fhir_ser ver_claim_ response_d etail4 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
66 | //.get(' /Bundle?us e=837&loca tion=442&_ id=2113072 ') | |
67 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 44 2, 2113072 )) | |
68 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
69 | ||
70 | ||
71 | }) | |
72 | after( () => { | |
73 | ap p.stop() | |
74 | no ck.cleanAl l() | |
75 | }) | |
76 | ||
77 | ||
78 | it("ha ppy path ( with amqp available) ", functio n (done) { | |
79 | th is.timeout (30000) | |
80 | ||
81 | le t testConf ig = Objec t.assign({ }, mock_cl aim.CONFIG ) | |
82 | te stConfig.d escription = "happy path (with amqp avai lable)" | |
83 | ||
84 | // chai.requ est(DEV_SE RVER) | |
85 | ch ai.request (app.baseA ddress()) | |
86 | //chai.r equest('ht tp://local host:3000' ) | |
87 | .post('/ api/fsc/v2 ') | |
88 | ||
89 | .set('se cid', 'MOC K-SECID-00 00011111') | |
90 | .send({ | |
91 | para ms: testCo nfig | |
92 | }) | |
93 | .end((er r, res) => { | |
94 | expe ct(res).to .have.stat us(200) | |
95 | let results = res.body | |
96 | // n ot sure wh y json is empty | |
97 | expe ct(results .data.queu e.statusCo de).to.eq( 200) | |
98 | ||
99 | done () | |
100 | }) | |
101 | }) | |
102 | ||
103 | }) | |
104 | ||
105 | describe(" POST /api/ fsc/v2/837 with nock - 2", fun ction () { | |
106 | before (() => { | |
107 | ap p.start() | |
108 | le t iens_url = busines s.TEMPLATE _fsc_837_i ens_url(mo ck_claim.C ONFIG) | |
109 | ||
110 | // N.B. You must have a respone for every request, s ince we ar e running two tests | |
111 | le t fhir_ser ver_claim_ response = nock(mock _claim.CON FIG.tasFHI REndpoint) | |
112 | .get(ien s_url) | |
113 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
114 | ||
115 | let fhir_serv er_claim_r esponse1 = nock(mock _claim.CON FIG.tasFHI REndpoint) | |
116 | .get(bus iness.TEMP LATE_fsc_8 37_iens_ur l(mock_cla im.CONFIG) ) | |
117 | .reply(2 00, mock_c laim.MOCK_ FSC_837_IE NS_FOR_MOC HA) | |
118 | ||
119 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=442&_ id=2113071 " | |
120 | le t fhir_ser ver_claim_ response_d etail1 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
121 | //.get(' /Bundle?us e=837&loca tion=442&_ id=2113071 ') | |
122 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 44 2, 2113071 )) | |
123 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
124 | ||
125 | let fhir _server_cl aim_respon se_detail2 = nock(mo ck_claim.C ONFIG.tasF HIREndpoin t) | |
126 | //.get(' /Bundle?us e=837&loca tion=442&_ id=2113072 ') | |
127 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 44 2, 2113072 )) | |
128 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
129 | ||
130 | ||
131 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=442&_ id=2113071 " | |
132 | le t fhir_ser ver_claim_ response_d etail3 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
133 | //.get(' /Bundle?us e=837&loca tion=442&_ id=2113071 ') | |
134 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 44 2, 2113071 )) | |
135 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
136 | ||
137 | le t fhir_ser ver_claim_ response_d etail4 = n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
138 | //.get(' /Bundle?us e=837&loca tion=442&_ id=2113072 ') | |
139 | .get(bus iness.TEMP LATE_fsc_8 37_bundle_ url(mock_c laim.CONFI G, 837, 44 2, 2113072 )) | |
140 | .reply(2 00, mock_c laim.MOCK_ FSC_837_FO R_MOCHA) | |
141 | ||
142 | // | |
143 | // | |
144 | // | |
145 | ||
146 | n ock(mock_c laim.CONFI G.tasFHIRE ndpoint) | |
147 | .g et(iens_ur l) | |
148 | .r eply(200, mock_claim .MOCK_FSC_ 837_IENS_F OR_MOCHA) | |
149 | ||
150 | nock(m ock_claim. CONFIG.tas FHIREndpoi nt) | |
151 | .g et(busines s.TEMPLATE _fsc_837_i ens_url(mo ck_claim.C ONFIG)) | |
152 | .r eply(200, mock_claim .MOCK_FSC_ 837_IENS_F OR_MOCHA) | |
153 | ||
154 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=442&_ id=2113071 " | |
155 | nock( mock_claim .CONFIG.ta sFHIREndpo int) | |
156 | // .get('/Bun dle?use=83 7&location =442&_id=2 113071') | |
157 | .g et(busines s.TEMPLATE _fsc_837_b undle_url( mock_claim .CONFIG, 8 37, 442, 2 113071)) | |
158 | .r eply(200, mock_claim .MOCK_FSC_ 837_FOR_MO CHA) | |
159 | ||
160 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
161 | // .get('/Bun dle?use=83 7&location =442&_id=2 113072') | |
162 | .g et(busines s.TEMPLATE _fsc_837_b undle_url( mock_claim .CONFIG, 8 37, 442, 2 113072)) | |
163 | .r eply(200, mock_claim .MOCK_FSC_ 837_FOR_MO CHA) | |
164 | ||
165 | ||
166 | // url:"ht tps:// DNS . URL /VA-FHIR-S erver/fhir /Bundle?us e=837&loca tion=442&_ id=2113071 " | |
167 | nock( mock_claim .CONFIG.ta sFHIREndpo int) | |
168 | // .get('/Bun dle?use=83 7&location =442&_id=2 113071') | |
169 | .g et(busines s.TEMPLATE _fsc_837_b undle_url( mock_claim .CONFIG, 8 37, 442, 2 113071)) | |
170 | .r eply(200, mock_claim .MOCK_FSC_ 837_FOR_MO CHA) | |
171 | ||
172 | nock( mock_claim .CONFIG.ta sFHIREndpo int) | |
173 | // .get('/Bun dle?use=83 7&location =442&_id=2 113072') | |
174 | .g et(busines s.TEMPLATE _fsc_837_b undle_url( mock_claim .CONFIG, 8 37, 442, 2 113072)) | |
175 | .r eply(200, mock_claim .MOCK_FSC_ 837_FOR_MO CHA) | |
176 | ||
177 | ||
178 | }) | |
179 | after( () => { | |
180 | ap p.stop() | |
181 | no ck.cleanAl l() | |
182 | }) | |
183 | ||
184 | ||
185 | // que ue not ava ilable | |
186 | it("ma lformed am qp uri", f unction (d one) { | |
187 | th is.timeout (14000) | |
188 | ||
189 | le t hold_TAS _QUEUE_ADD RESS = pro cess.env.T AS_QUEUE_A DDRESS | |
190 | pr ocess.env. TAS_QUEUE_ ADDRESS = "http://lo calhost" | |
191 | ||
192 | le t testConf ig = Objec t.assign({ }, mock_cl aim.CONFIG ) | |
193 | te stConfig.d escription = "malfor med amqp u ri" | |
194 | ||
195 | // chai.requ est(DEV_SE RVER) | |
196 | ch ai.request (app.baseA ddress()) | |
197 | //chai.r equest('ht tp://local host:3000' ) | |
198 | .post('/ api/fsc/v2 ') | |
199 | .set('se cid', 'MOC K-SECID-00 00011111') | |
200 | .send({ | |
201 | para ms: testCo nfig | |
202 | }) | |
203 | .end((er r, res) => { | |
204 | proc ess.env.TA S_QUEUE_AD DRESS = ho ld_TAS_QUE UE_ADDRESS | |
205 | expe ct(res).to .have.stat us(200) | |
206 | let results = res.body | |
207 | ||
208 | // e xpect the queue sect ion to hav e 500 stat us code | |
209 | expe ct(results .data.queu e.statusCo de).to.eq( 500) | |
210 | done () | |
211 | }) | |
212 | }) | |
213 | ||
214 | }) | |
215 | ||
216 | describe(" POST /api/ fsc/v2/837 with nock - 3", fun ction () { | |
217 | before (() => { | |
218 | ap p.start() | |
219 | }) | |
220 | after( () => { | |
221 | ap p.stop() | |
222 | }) | |
223 | ||
224 | // fir st getBund le() fails ; webclien t throws 4 04 | |
225 | it("ma lformed VA _FHIR_SERV ER uri", f unction (d one) { | |
226 | th is.timeout (14000) | |
227 | ||
228 | le t testConf ig = Objec t.assign({ }, mock_cl aim.CONFIG ) | |
229 | te stConfig.d escription = "malfor med VA_FHI R_SERVER u ri" | |
230 | te stConfig.t asFHIREndp oint = "ht tp://local host" | |
231 | // chai.requ est(DEV_SE RVER) | |
232 | ch ai.request (app.baseA ddress()) | |
233 | //chai.r equest('ht tp://local host:3000' ) | |
234 | .post('/ api/fsc/v2 ') | |
235 | ||
236 | .set('se cid', 'MOC K-SECID-00 00011111') | |
237 | .send({ | |
238 | para ms: testCo nfig | |
239 | }) | |
240 | .end((er r, res) => { | |
241 | ||
242 | // e xpect a ge neral exce ption | |
243 | expe ct(res).to .have.stat us(500) | |
244 | let results = res.body | |
245 | done () | |
246 | }) | |
247 | }) | |
248 | ||
249 | }) | |
250 | ||
251 | describe(" POST /api/ fsc/v2/837 with nock - 4", fun ction () { | |
252 | before (() => { | |
253 | ap p.start() | |
254 | le t iens_url = busines s.TEMPLATE _fsc_837_i ens_url(mo ck_claim.C ONFIG) | |
255 | ||
256 | // return 50 0 | |
257 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
258 | .get(bus iness.TEMP LATE_fsc_8 37_iens_ur l(mock_cla im.CONFIG) ) | |
259 | .reply(5 00, { mess age: 'moch aTest:malf ormed VA_F HIR_SERVER 500'}) | |
260 | ||
261 | no ck(mock_cl aim.CONFIG .tasFHIREn dpoint) | |
262 | .get(bus iness.TEMP LATE_fsc_8 37_iens_ur l(mock_cla im.CONFIG) ) | |
263 | .reply(5 00, { mess age: 'moch aTest:malf ormed VA_F HIR_SERVER 500'}) | |
264 | ||
265 | }) | |
266 | after( () => { | |
267 | ap p.stop() | |
268 | no ck.cleanAl l() | |
269 | }) | |
270 | ||
271 | ||
272 | // ien s 500 retu rned from NOCK | |
273 | // 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 | |
274 | // fhi r_server_c laim_respo nse and fh ir_server_ claim_resp onse1 | |
275 | ||
276 | it("VA _FHIR_SERV ER 500", f unction (d one) { | |
277 | th is.timeout (14000) | |
278 | le t testConf ig = Objec t.assign({ }, mock_cl aim.CONFIG ) | |
279 | te stConfig.d escription = "VA_FHI R_SERVER 5 00" | |
280 | // chai.requ est(DEV_SE RVER) | |
281 | ch ai.request (app.baseA ddress()) | |
282 | //chai.r equest('ht tp://local host:3000' ) | |
283 | .post('/ api/fsc/v2 ') | |
284 | ||
285 | .set('se cid', 'MOC K-SECID-00 00011111') | |
286 | .send({ | |
287 | para ms: testCo nfig | |
288 | }) | |
289 | .end((er r, res) => { | |
290 | //sh ould.not.e xist(res.b ody.except ion) | |
291 | expe ct(res).to .have.stat us(500) | |
292 | let results = res.body | |
293 | expe ct(results .data.iens .statusCod e).to.eq(5 00) | |
294 | done () | |
295 | }) | |
296 | }) | |
297 | ||
298 | }) | |
299 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.