Produced by Araxis Merge on 10/3/2017 11:16:03 AM Central 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 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\handlers\hdr-xform-domain-vpr | hdr-xform-domain-vpr-handler-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\handlers\hdr-xform-domain-vpr | hdr-xform-domain-vpr-handler-spec.js | Tue Oct 3 13:17:13 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 756 |
| Changed | 1 | 4 |
| 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 | require('. ./../../.. /env-setup '); | |
| 4 | ||
| 5 | var handle r = requir e(global.V X_HANDLERS + 'hdr-xf orm-domain -vpr/hdr-x form-domai n-vpr-hand ler'); | |
| 6 | var log = require(gl obal.VX_DU MMIES + 'd ummy-logge r'); | |
| 7 | var Operat ionaldataS yncUtil = require(gl obal.VX_UT ILS + 'sit e-operatio nal-data-s tatus-util '); | |
| 8 | ||
| 9 | // var log = require ('bunyan') .createLog ger({ | |
| 10 | // nam e: 'shutdo wn-vxsync- util', | |
| 11 | // lev el: 'trace ' | |
| 12 | // }); | |
| 13 | ||
| 14 | var mockCo nfig = { | |
| 15 | hdr: { | |
| 16 | do mains: ['a llergy'] | |
| 17 | }, | |
| 18 | jds: { | |
| 19 | pr otocol: 'h ttp', | |
| 20 | host: ' IP ', | |
| 21 | port: PORT | |
| 22 | }, | |
| 23 | 'vista Sites' : { | |
| 24 | '9 E7A': { | |
| 25 | 'name': 'panorama' | |
| 26 | }, | |
| 27 | 'C 877': { | |
| 28 | 'name': 'kodak' | |
| 29 | } | |
| 30 | } | |
| 31 | }; | |
| 32 | ||
| 33 | var refere nceInfo = { | |
| 34 | sessio nId: 'test -session-i d', | |
| 35 | reques tId: 'test -request-i d' | |
| 36 | }; | |
| 37 | ||
| 38 | var JdsCli entDummy = require(g lobal.VX_D UMMIES + ' jds-client -dummy'); | |
| 39 | var jdsCli entDummy = new JdsCl ientDummy( log, mockC onfig); | |
| 40 | ||
| 41 | var mockEn vironment = { | |
| 42 | publis herRouter: { | |
| 43 | pu blish: fun ction(jobs ToPublish, callback) { | |
| 44 | callback (null, 'su ccess'); | |
| 45 | } | |
| 46 | }, | |
| 47 | jds: j dsClientDu mmy | |
| 48 | }; | |
| 49 | var mockHa ndlerCallb ack = { | |
| 50 | callba ck: functi on(error, response) { | |
| 51 | } | |
| 52 | }; | |
| 53 | ||
| 54 | var mockOD SyncedSite s = ['9E7A ']; | |
| 55 | ||
| 56 | var hdrIte ms = requi re('../../ ../data/se condary/hd r/allergy' ); | |
| 57 | ||
| 58 | describe(' hdr-xform- domain-vpr -handler', function( ) { | |
| 59 | ||
| 60 | descri be('xformI temCollect ion', func tion() { | |
| 61 | ||
| 62 | va r mockRequ estStampTi me = '2014 0113154827 .356'; | |
| 63 | ||
| 64 | va r mockEdip i = '00000 099'; | |
| 65 | ||
| 66 | va r sampleCD SAllergy = { | |
| 67 | comments : [ | |
| 68 | { | |
| 69 | comm ent: ' TES TING DIETE TICS', | |
| 70 | ente red: 19940 119082309, | |
| 71 | ente redByName: 'PROGRAMM ER,TWENTY' , | |
| 72 | ente redByUid: 'urn:va:us er:ABCD:75 5' | |
| 73 | } | |
| 74 | ], | |
| 75 | entered: 199401190 822, | |
| 76 | facility Code: 561, | |
| 77 | facility Name: 'New Jersey HC S', | |
| 78 | historic al: true, | |
| 79 | kind: 'A llergy / A dverse Rea ction', | |
| 80 | localId: 106, | |
| 81 | signedDa teTime: '0 5/16/07 09 :50', | |
| 82 | mechanis m: 'ALLERG Y', | |
| 83 | originat orName: 'P ROGRAMMER, TWENTY', | |
| 84 | products : [ | |
| 85 | { | |
| 86 | name : 'MILK', | |
| 87 | vuid : 'urn:va: vuid:46369 81' | |
| 88 | } | |
| 89 | ], | |
| 90 | reaction s: [ | |
| 91 | { | |
| 92 | name : 'NAUSEA, VOMITING', | |
| 93 | vuid : 'urn:va: vuid:' | |
| 94 | } | |
| 95 | ], | |
| 96 | referenc e: '29;GMR D(120.82,' , | |
| 97 | summary: 'MILK', | |
| 98 | typeName : 'DRUG, F OOD', | |
| 99 | uid: 'ur n:va:aller gy:ABCD:16 :106', | |
| 100 | verified : 19940119 082339, | |
| 101 | verifier Name: 'PRO GRAMMER,TW ENTY' | |
| 102 | }; | |
| 103 | ||
| 104 | va r sampleIt emCollecti on ={ | |
| 105 | data: { | |
| 106 | item s:[sampleC DSAllergy] | |
| 107 | } | |
| 108 | }; | |
| 109 | ||
| 110 | va r sampleVP RAllergy = { | |
| 111 | comments : [ | |
| 112 | { | |
| 113 | comm ent: ' TES TING DIETE TICS', | |
| 114 | ente red: 19940 119082309, | |
| 115 | ente redByName: 'PROGRAMM ER,TWENTY' , | |
| 116 | ente redByUid: 'urn:va:us er:ABCD:75 5' | |
| 117 | } | |
| 118 | ], | |
| 119 | entered: 199401190 822, | |
| 120 | facility Code: 561, | |
| 121 | facility Name: 'New Jersey HC S', | |
| 122 | historic al: true, | |
| 123 | kind: 'A llergy / A dverse Rea ction', | |
| 124 | localId: 106, | |
| 125 | signedDa teTime: '2 0070516095 000', | |
| 126 | mechanis m: 'ALLERG Y', | |
| 127 | originat orName: 'P ROGRAMMER, TWENTY', | |
| 128 | products : [ | |
| 129 | { | |
| 130 | name : 'MILK', | |
| 131 | vuid : 'urn:va: vuid:46369 81' | |
| 132 | } | |
| 133 | ], | |
| 134 | reaction s: [ | |
| 135 | { | |
| 136 | name : 'NAUSEA, VOMITING', | |
| 137 | vuid : 'urn:va: vuid:' | |
| 138 | } | |
| 139 | ], | |
| 140 | referenc e: '29;GMR D(120.82,' , | |
| 141 | summary: 'MILK', | |
| 142 | typeName : 'DRUG, F OOD', | |
| 143 | uid: 'ur n:va:aller gy:ABCD:16 :106', | |
| 144 | verified : 19940119 082339, | |
| 145 | verifier Name: 'PRO GRAMMER,TW ENTY', | |
| 146 | pid: 'HD R;00000099 ', | |
| 147 | stampTim e: '201401 13154827.3 56' | |
| 148 | }; | |
| 149 | ||
| 150 | va r vprItems = handler ._steps._x formItemCo llection(l og, mockCo nfig, samp leItemColl ection, mo ckEdipi, m ockRequest StampTime) ; | |
| 151 | ||
| 152 | it ('result i ncludes sa mple VPR a llergy', f unction() { | |
| 153 | expect(v prItems).t oContain(s ampleVPRAl lergy); | |
| 154 | }) ; | |
| 155 | ||
| 156 | it ('result i ncludes st ampTime', function() { | |
| 157 | expect(v prItems[0] .stampTime ).toBeTrut hy(); | |
| 158 | }) ; | |
| 159 | ||
| 160 | it ('Checks H DR to VPR transforma tion for c orrect pid ', functio n() { | |
| 161 | expect(v prItems[0] .pid).toEq ual('HDR;' + mockEdi pi); | |
| 162 | }) ; | |
| 163 | }); | |
| 164 | ||
| 165 | descri be('handle ', functio n() { | |
| 166 | be foreEach(f unction() { | |
| 167 | spyOn(mo ckHandlerC allback, ' callback') ; | |
| 168 | }) ; | |
| 169 | ||
| 170 | it ('error co ndition: i ncorrect j ob type', function() { | |
| 171 | var done = false; | |
| 172 | ||
| 173 | runs(fun ction() { | |
| 174 | var job = {}; | |
| 175 | job. type = 'hd r-xform-vp r'; | |
| 176 | job. record = { }; | |
| 177 | //jo b.record.d ata = {}; | |
| 178 | //jo b.record.d ata.items = {}; | |
| 179 | job. jpid = 'aa a-aaaaa-aa aaaaaaaaa' ; | |
| 180 | ||
| 181 | job. patientIde ntifier = { | |
| 182 | type: 'icn ', | |
| 183 | value: '00 000V00000' | |
| 184 | }; | |
| 185 | ||
| 186 | //sp yOn(mockHa ndlerCallb ack, 'call back'); | |
| 187 | ||
| 188 | hand ler(log, m ockConfig, mockEnvir onment, jo b, functio n() { | |
| 189 | done = tru e; | |
| 190 | mockHandle rCallback. callback() ; | |
| 191 | }); | |
| 192 | }); | |
| 193 | ||
| 194 | waitsFor (function( ) { | |
| 195 | retu rn done; | |
| 196 | }, 'Call back not c alled', 10 0); | |
| 197 | ||
| 198 | runs(fun ction() { | |
| 199 | expe ct(mockHan dlerCallba ck.callbac k).toHaveB eenCalled( ); | |
| 200 | }); | |
| 201 | }) ; | |
| 202 | it ('error co ndition: w rong patie nt identif ier', func tion() { | |
| 203 | var done = false; | |
| 204 | runs(fun ction() { | |
| 205 | var job = {}; | |
| 206 | job. type = 'hd r-xform-al lergy-vpr' ; | |
| 207 | job. dataDomain = 'allerg y'; | |
| 208 | job. record = h drItems; / /{}; | |
| 209 | job. requestSta mpTime = ' 2014010212 0059.000'; | |
| 210 | job. jpid = 'aa a-aaaaa-aa aaaaaaaaa' ; | |
| 211 | job. icn = '000 00V00000'; | |
| 212 | ||
| 213 | job. patientIde ntifier = { | |
| 214 | type: 'pid ', | |
| 215 | value: '9E 7A;3' | |
| 216 | }; | |
| 217 | ||
| 218 | ||
| 219 | hand ler(log, m ockConfig, mockEnvir onment, jo b, functio n() { | |
| 220 | done = tru e; | |
| 221 | mockHandle rCallback. callback() ; | |
| 222 | }); | |
| 223 | ||
| 224 | wait sFor(funct ion() { | |
| 225 | return don e; | |
| 226 | }, ' Callback n ot called' , 100); | |
| 227 | ||
| 228 | runs (function( ) { | |
| 229 | expect(moc kHandlerCa llback.cal lback).toH aveBeenCal led(); | |
| 230 | }); | |
| 231 | }); | |
| 232 | }) ; | |
| 233 | it ('error co ndition: i nvalid dom ain type', function( ) { | |
| 234 | var done = false; | |
| 235 | runs(fun ction() { | |
| 236 | var job = {}; | |
| 237 | job. type = 'hd r-xform-al lergy-vpr' ; | |
| 238 | job. dataDomain = 'fake d omain'; | |
| 239 | job. record = h drItems; / /{}; | |
| 240 | job. requestSta mpTime = ' 2014010212 0059.000'; | |
| 241 | job. jpid = 'aa a-aaaaa-aa aaaaaaaaa' ; | |
| 242 | ||
| 243 | job. patientIde ntifier = { | |
| 244 | type: 'edi pi', | |
| 245 | value: '00 00096' | |
| 246 | }; | |
| 247 | ||
| 248 | //sp yOn(mockHa ndlerCallb ack, 'call back'); | |
| 249 | ||
| 250 | hand ler(log, m ockConfig, mockEnvir onment, jo b, functio n() { | |
| 251 | done = tru e; | |
| 252 | mockHandle rCallback. callback() ; | |
| 253 | }); | |
| 254 | }); | |
| 255 | ||
| 256 | waitsFor (function( ) { | |
| 257 | retu rn done; | |
| 258 | }, 'Call back not c alled', 10 0); | |
| 259 | ||
| 260 | runs(fun ction() { | |
| 261 | expe ct(mockHan dlerCallba ck.callbac k).toHaveB eenCalled( ); | |
| 262 | }); | |
| 263 | }) ; | |
| 264 | de scribe('tr ansformati on and job creation' , function () { | |
| 265 | beforeEa ch(functio n() { | |
| 266 | spyO n(mockEnvi ronment.pu blisherRou ter, 'publ ish').andC allThrough (); | |
| 267 | spyO n(jdsClien tDummy, 's aveSyncSta tus').andC allThrough (); | |
| 268 | }); | |
| 269 | ||
| 270 | it('shou ld publish a separat e job for each trans formed dat a item fro m sample d ata', func tion() { | |
| 271 | log. debug('hdr -xform-dom ain-vpr-ha ndler-spec : ***** ST ARTING TES T NOW **** ****'); | |
| 272 | ||
| 273 | var job = {}; | |
| 274 | job. type = 'hd r-xform-al lergy-vpr' ; | |
| 275 | job. dataDomain = 'allerg y'; | |
| 276 | job. record = h drItems; / /{}; | |
| 277 | job. requestSta mpTime = ' 2014010212 0059.000'; | |
| 278 | job. jpid = 'aa a-aaaaa-aa aaaaaaaaa' ; | |
| 279 | job. icn = '9E7 A;3'; | |
| 280 | job. patientIde ntifier = { | |
| 281 | type: 'pid ', | |
| 282 | value: 'HD R;00001' | |
| 283 | }; | |
| 284 | job. referenceI nfo = refe renceInfo; | |
| 285 | ||
| 286 | var expectedJd sResponse = { | |
| 287 | statusCode : 200 | |
| 288 | }; | |
| 289 | jdsC lientDummy ._setRespo nseData(nu ll, expect edJdsRespo nse, null) ; | |
| 290 | ||
| 291 | var finished = false; | |
| 292 | var actualErro r; | |
| 293 | var actualResp onse; | |
| 294 | runs (function( ) { | |
| 295 | handler(lo g, mockCon fig, mockE nvironment , job, fun ction(erro r, respons e) { | |
| 296 | actual Error = er ror; | |
| 297 | actual Response = response; | |
| 298 | finish ed = true; | |
| 299 | }); | |
| 300 | }); | |
| 301 | ||
| 302 | wait sFor(funct ion() { | |
| 303 | return fin ished; | |
| 304 | }, ' Call to ha ndler fail ed to retu rn in time .', 1000); | |
| 305 | runs (function( ) { | |
| 306 | log.debug( 'hdr-xform -domain-vp r-handler- spec: **** * DONE WAI TING ***** ***'); | |
| 307 | ||
| 308 | //Get info rmation ab out calls made to pu blisherRou ter.publis h | |
| 309 | //-------- ---------- ---------- ---------- ---------- ---------- -- | |
| 310 | var publis hCalls = m ockEnviron ment.publi sherRouter .publish.c alls; | |
| 311 | log.debug( 'hdr-xform -domain-vp r-handler- spec: publ ishCalls: %j', publi shCalls); | |
| 312 | ||
| 313 | expect(pub lishCalls[ 0].args[0] .length).t oEqual(1); | |
| 314 | ||
| 315 | log.debug( 'hdr-xform -domain-vp r-handler- spec: **** * AFTER TE ST NOW *** *****'); | |
| 316 | ||
| 317 | //Get jobs published and compa re them to expected jobs | |
| 318 | var jobsPu blished = publishCal ls[0].args [0]; | |
| 319 | var expect edJobs = [ { | |
| 320 | 'type' : 'event-p rioritizat ion-reques t', | |
| 321 | 'patie ntIdentifi er': { | |
| 322 | 't ype': 'pid ', | |
| 323 | 'v alue': 'HD R;00001' | |
| 324 | }, | |
| 325 | 'refer enceInfo': reference Info, | |
| 326 | 'jpid' : 'aaa-aaa aa-aaaaaaa aaaa', | |
| 327 | 'dataD omain': 'a llergy', | |
| 328 | 'recor d': { | |
| 329 | 'c omments': [ | |
| 330 | { | |
| 331 | 'comment ': ' TESTI NG DIETETI CS', | |
| 332 | 'entered ': 1994011 9082309, | |
| 333 | 'entered ByName': ' PROGRAMMER ,TWENTY', | |
| 334 | 'entered ByUid': 'u rn:va:user :ABCD:755' | |
| 335 | } | |
| 336 | ], | |
| 337 | 'e ntered': 1 9940119082 2, | |
| 338 | 'f acilityCod e': 561, | |
| 339 | 'f acilityNam e': 'New J ersey HCS' , | |
| 340 | 'h istorical' : true, | |
| 341 | 'k ind': 'All ergy / Adv erse React ion', | |
| 342 | 'l ocalId': 1 06, | |
| 343 | 'm echanism': 'ALLERGY' , | |
| 344 | 'o riginatorN ame': 'PRO GRAMMER,TW ENTY', | |
| 345 | 'p roducts': [ | |
| 346 | { | |
| 347 | 'name': 'MILK', | |
| 348 | 'vuid': 'urn:va:vu id:4636981 ' | |
| 349 | } | |
| 350 | ], | |
| 351 | 'r eactions': [ | |
| 352 | { | |
| 353 | 'name': 'NAUSEA,VO MITING', | |
| 354 | 'vuid': 'urn:va:vu id:' | |
| 355 | } | |
| 356 | ], | |
| 357 | 'r eference': '29;GMRD( 120.82,', | |
| 358 | 's ummary': ' MILK', | |
| 359 | 't ypeName': 'DRUG, FOO D', | |
| 360 | 'u id': 'urn: va:allergy :ABCD:16:1 06', | |
| 361 | 'v erified': 1994011908 2339, | |
| 362 | 'v erifierNam e': 'PROGR AMMER,TWEN TY', | |
| 363 | 'p id': 'HDR; 00001', | |
| 364 | 's tampTime': '20140102 120059.000 ' | |
| 365 | } | |
| 366 | } | |
| 367 | ]; | |
| 368 | ||
| 369 | expect(job sPublished [0].jobId) .toBeDefin ed(); | |
| 370 | delete job sPublished [0].jobId; | |
| 371 | delete job sPublished [0].timest amp; | |
| 372 | expect(job sPublished ).toEqual( expectedJo bs); | |
| 373 | ||
| 374 | }); | |
| 375 | }); | |
| 376 | }) ; | |
| 377 | ||
| 378 | }); | |
| 379 | ||
| 380 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.