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\vista-record-processor | VistaRecordProcessor-spec.js | Fri Jul 28 14:07:44 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\handlers\vista-record-processor | VistaRecordProcessor-spec.js | Mon Oct 2 20:06:20 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 3434 |
| Changed | 1 | 2 |
| 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 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
| 4 | // This fi le contain s unit tes ts for vis ta-record- processor. js. | |
| 5 | // | |
| 6 | // Author: Mike Rish er, Les We stberg | |
| 7 | //-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------ | |
| 8 | ||
| 9 | require('. ./../../.. /env-setup '); | |
| 10 | ||
| 11 | var fs = r equire('fs '); | |
| 12 | var path = require(' path'); | |
| 13 | var async = require( 'async'); | |
| 14 | var Proces sor = requ ire(global .VX_HANDLE RS + 'vist a-record-p rocessor/V istaRecord Processor' ); | |
| 15 | var Publis herRouterD ummy = req uire(globa l.VX_DUMMI ES + 'publ isherRoute rDummy'); | |
| 16 | var Publis herDummy = require(g lobal.VX_D UMMIES + ' publisherD ummy'); | |
| 17 | var patIdC ompareUtil = require (global.VX _DUMMIES + 'patient- id-compara tor-dummy' ); | |
| 18 | var metric sDummyLogg er = requi re(global. VX_DUMMIES + 'dummy- logger'); | |
| 19 | var dummyL ogger = re quire(glob al.VX_DUMM IES + 'dum my-logger' ); | |
| 20 | ||
| 21 | // MAKE SU RE YOU COM MENT OUT T HE FOLLOWI NG BEFORE CHECKING I N | |
| 22 | //-------- ---------- ---------- ---------- ---------- ---------- -- | |
| 23 | // // var logConfig = require( './worker- config'); | |
| 24 | // var log Config = { | |
| 25 | // 'lo ggers': [{ | |
| 26 | // 'name': ' root', | |
| 27 | // 'streams' : [{ | |
| 28 | // 'stre am': proce ss.stdout, | |
| 29 | // 'leve l': 'debug ' | |
| 30 | // }] | |
| 31 | // }], | |
| 32 | // }; | |
| 33 | // var log Util = req uire(globa l.VX_UTILS + 'log'); | |
| 34 | // logUtil .initializ e(logConfi g.loggers) ; | |
| 35 | // var dum myLogger = logUtil.g et('VistaR ecordProce ssor-spec' , 'host'); | |
| 36 | // End of code to co mment out. | |
| 37 | ||
| 38 | var publis herRouterD ummy = new Publisher RouterDumm y(dummyLog ger, confi g, Publish erDummy); | |
| 39 | var JobSta tusUpdater = require (global.VX _SUBSYSTEM S + 'jds/J obStatusUp dater'); | |
| 40 | var JdsCli entDummy = require(g lobal.VX_D UMMIES + ' jds-client -dummy'); | |
| 41 | ||
| 42 | var config = { | |
| 43 | jds: { | |
| 44 | pr otocol: 'h ttp', | |
| 45 | host: ' IP ', | |
| 46 | po rt: 9080 | |
| 47 | }, | |
| 48 | 'hmp.b atch.size' : 1000, | |
| 49 | hdr: { | |
| 50 | hd rSites: { | |
| 51 | '84F0': { | |
| 52 | stat ionNumber: 578 | |
| 53 | } | |
| 54 | }, | |
| 55 | pu bsubConfig : { | |
| 56 | maxBatch Size: 500 | |
| 57 | } | |
| 58 | }, | |
| 59 | syncNo tification s: { | |
| 60 | di scharge: { | |
| 61 | dataDoma in: 'disch arge' | |
| 62 | } | |
| 63 | } | |
| 64 | }; | |
| 65 | ||
| 66 | var jdsCli entDummy = new JdsCl ientDummy( dummyLogge r, config) ; | |
| 67 | var lastUp dateTimeVa lue = '315 0106-1624' ; | |
| 68 | var vistaI dValue = ' C877'; | |
| 69 | ||
| 70 | var enviro nment = { | |
| 71 | jobSta tusUpdater : {}, | |
| 72 | patien tIdCompara tor :{}, | |
| 73 | metric s: metrics DummyLogge r, | |
| 74 | publis herRouter: publisher RouterDumm y, | |
| 75 | jds: j dsClientDu mmy | |
| 76 | }; | |
| 77 | environmen t.jobStatu sUpdater = new JobSt atusUpdate r(dummyLog ger, confi g, environ ment.jds); | |
| 78 | environmen t.patientI dComparato r = patId CompareUti l.detectAn dResync; | |
| 79 | ||
| 80 | // Set up the error publisher | |
| 81 | //-------- ---------- --------- | |
| 82 | var errorP ublisher = { | |
| 83 | 'publi shPollerEr ror': func tion(site, item, err orMessage, callback) { | |
| 84 | re turn setTi meout(call back, 0, n ull, null) ; | |
| 85 | } | |
| 86 | }; | |
| 87 | environmen t.errorPub lisher = e rrorPublis her; | |
| 88 | ||
| 89 | var proces sor = new Processor( dummyLogge r, config, environme nt); | |
| 90 | ||
| 91 | var patien tIdentifie rValue1 = { | |
| 92 | type: 'pid', | |
| 93 | value: vistaIdVa lue + ';1' | |
| 94 | }; | |
| 95 | ||
| 96 | var syncSt artJobsVal ue = [{ | |
| 97 | collec tion: 'syn cStart', | |
| 98 | pid: v istaIdValu e + ';1', | |
| 99 | refere nceInfo: { | |
| 100 | 'p riority': 1, | |
| 101 | 'r equestId': 'req1234' , | |
| 102 | 's essionId': 'sess1234 ' | |
| 103 | }, | |
| 104 | metaSt amp: { | |
| 105 | st ampTime: ' 2015011411 5126', | |
| 106 | so urceMetaSt amp: { | |
| 107 | 'C877': { | |
| 108 | pid: vistaIdVa lue + ';1' , | |
| 109 | loca lId: '1', | |
| 110 | stam pTime: '20 1501141151 26', | |
| 111 | doma inMetaStam p: { | |
| 112 | 'allergy': { | |
| 113 | domain : 'allergy ', | |
| 114 | stampT ime: '2015 0114115126 ', | |
| 115 | eventM etaStamp: { | |
| 116 | 'u rn:va:alle rgy:C877:1 :751': { | |
| 117 | stampTim e: '201501 14115126' | |
| 118 | }, | |
| 119 | 'u rn:va:alle rgy:C877:1 :752': { | |
| 120 | stampTim e: '201501 14115126' | |
| 121 | } | |
| 122 | } | |
| 123 | } | |
| 124 | } | |
| 125 | } | |
| 126 | } | |
| 127 | } | |
| 128 | }, { | |
| 129 | collec tion: 'syn cStart', | |
| 130 | pid: v istaIdValu e + ';2', | |
| 131 | refere nceInfo: { | |
| 132 | 'p riority': 1, | |
| 133 | 'r equestId': 'req1234' , | |
| 134 | 's essionId': 'sess1234 ' | |
| 135 | }, | |
| 136 | metaSt amp: { | |
| 137 | st ampTime: ' 2015011411 5126', | |
| 138 | so urceMetaSt amp: { | |
| 139 | 'C877': { | |
| 140 | pid: vistaIdVa lue + ';2' , | |
| 141 | loca lId: '1', | |
| 142 | stam pTime: '20 1501141151 26', | |
| 143 | doma inMetaStam p: { | |
| 144 | 'allergy': { | |
| 145 | domain : 'allergy ', | |
| 146 | stampT ime: '2015 0114115126 ', | |
| 147 | eventM etaStamp: { | |
| 148 | 'u rn:va:alle rgy:C877:2 :300': { | |
| 149 | stampTim e: '201501 14115126' | |
| 150 | }, | |
| 151 | 'u rn:va:alle rgy:C877:2 :301': { | |
| 152 | stampTim e: '201501 14115126' | |
| 153 | } | |
| 154 | } | |
| 155 | } | |
| 156 | } | |
| 157 | } | |
| 158 | } | |
| 159 | } | |
| 160 | }]; | |
| 161 | ||
| 162 | var syncSt artJobEmpt yMetastamp = { | |
| 163 | collec tion: 'syn cStart', | |
| 164 | rootJo bId: '11-1 11', | |
| 165 | jobId: '11-111', | |
| 166 | pid: v istaIdValu e + ';1', | |
| 167 | refere nceInfo: { | |
| 168 | 'p riority': 1, | |
| 169 | 'r equestId': 'req1234' , | |
| 170 | 'r ootJobId': '11-111', | |
| 171 | 's essionId': 'sess1234 ', | |
| 172 | 'j obId': '11 -111' | |
| 173 | }, | |
| 174 | metaSt amp: { | |
| 175 | st ampTime: ' 2015011411 5126', | |
| 176 | so urceMetaSt amp: { | |
| 177 | 'C877': { | |
| 178 | pid: vistaIdVa lue + ';1' , | |
| 179 | loca lId: '1', | |
| 180 | stam pTime: '20 1501141151 26', | |
| 181 | doma inMetaStam p: { | |
| 182 | 'auxillary ': { | |
| 183 | domain : 'auxilla ry', | |
| 184 | stampT ime: '2015 0114115126 ', | |
| 185 | eventM etaStamp: {} | |
| 186 | } | |
| 187 | } | |
| 188 | } | |
| 189 | } | |
| 190 | } | |
| 191 | }; | |
| 192 | ||
| 193 | var OPDsyn cStartJobs Value = [{ | |
| 194 | 'colle ction': 'O PDsyncStar t', | |
| 195 | 'syste mId': '9E7 A', | |
| 196 | 'rootJ obId': '1' , | |
| 197 | 'jobId ': '3', | |
| 198 | 'metaS tamp': { | |
| 199 | 's tampTime': 201410310 94920, | |
| 200 | 's ourceMetaS tamp': { | |
| 201 | '9E7A': { | |
| 202 | 'sta mpTime': 2 0141031094 920, | |
| 203 | 'dom ainMetaSta mp': { | |
| 204 | 'doc-def': { | |
| 205 | 'domai n': 'doc-d ef', | |
| 206 | 'stamp Time': 201 4103109492 0, | |
| 207 | 'itemM etaStamp': { | |
| 208 | 'u rn:va:doc- def:9E7A:1 001': { | |
| 209 | 'stampTi me': 20141 031094920 | |
| 210 | }, | |
| 211 | 'u rn:va:doc- def:9E7A:1 002': { | |
| 212 | 'stampTi me': 20141 031094920 | |
| 213 | } | |
| 214 | } | |
| 215 | }, | |
| 216 | 'pt-select ': { | |
| 217 | 'domai n': 'pt-se lect', | |
| 218 | 'stamp Time': 201 4103109492 0, | |
| 219 | 'itemM etaStamp': { | |
| 220 | 'u rn:va:pt-s elect:9E7A :1001': { | |
| 221 | 'stampTi me': 20141 031094920 | |
| 222 | }, | |
| 223 | 'u rn:va:pt-s elect:9E7a :1002': { | |
| 224 | 'stampTi me': 20141 031094920 | |
| 225 | } | |
| 226 | } | |
| 227 | } | |
| 228 | } | |
| 229 | } | |
| 230 | } | |
| 231 | } | |
| 232 | }]; | |
| 233 | ||
| 234 | var vistaD ataJobAlle rgyObjectW ithoutPid = { | |
| 235 | uid: ' urn:va:all ergy:9E7A: 1:27837' | |
| 236 | }; | |
| 237 | ||
| 238 | var vistaD ataJobsVal ue = [{ | |
| 239 | collec tion: 'all ergy', | |
| 240 | pid: v istaIdValu e + ';1', | |
| 241 | refere nceInfo: { | |
| 242 | 'p riority': '1', | |
| 243 | 'j obId': '11 -1', | |
| 244 | 'r ootJobId': '11', | |
| 245 | 'r equestId': 'req1234' , | |
| 246 | 's essionId': 'sess1234 ' | |
| 247 | }, | |
| 248 | object : vistaDat aJobAllerg yObjectWit houtPid | |
| 249 | }, { | |
| 250 | collec tion: 'pt- select', | |
| 251 | pid: v istaIdValu e + ';2', | |
| 252 | refere nceInfo: { | |
| 253 | 'p riority': '1', | |
| 254 | 'j obId': '11 -1', | |
| 255 | 'r ootJobId': '11', | |
| 256 | 'r equestId': 'req1234' , | |
| 257 | 's essionId': 'sess1234 ' | |
| 258 | }, | |
| 259 | object : { | |
| 260 | pi d: vistaId Value + '; 2' | |
| 261 | } | |
| 262 | }, { | |
| 263 | collec tion: 'doc -ref', | |
| 264 | object : { | |
| 265 | da ta: 'some operationa l data' | |
| 266 | } | |
| 267 | }]; | |
| 268 | ||
| 269 | var vistaE rrorItem = { | |
| 270 | 'error ': [{ | |
| 271 | 'c ollection' : 'med', | |
| 272 | 'e rror': 'A mumps erro r occurred when extr acting pat ient data. A total o f 1 occurr ed.\n\rAn error occu rred on pa tient: 100 296\n\rA p roblem occ urred conv erting ord er 39094 f or the med ication do main\n\r', | |
| 273 | 'u id': 'urn: va:med:9E7 A:100296:1 2345' | |
| 274 | }] | |
| 275 | }; | |
| 276 | ||
| 277 | var dataVa lue = { | |
| 278 | lastUp date: last UpdateTime Value, | |
| 279 | items: [] | |
| 280 | }; | |
| 281 | dataValue. items = sy ncStartJob sValue.con cat(vistaD ataJobsVal ue); | |
| 282 | ||
| 283 | var rootJo bIdValue = '1'; | |
| 284 | var jobIdV alue = '2' ; | |
| 285 | var jpidVa lue = '9a6 c3294-fe16 -4a91-b10b -19f78656f b8c'; | |
| 286 | ||
| 287 | // Configu rations re lated to V istaHdr | |
| 288 | var hdrIdV alue = '84 F0'; | |
| 289 | //var hdrU idValue = 'urn:va:vp rupdate:' + hdrIdVal ue; | |
| 290 | var hdrpro cessor = n ew Process or(dummyLo gger, conf ig, enviro nment); | |
| 291 | var hdrPat ientIdenti fierValue1 = { | |
| 292 | type: 'pid', | |
| 293 | value: hdrIdValu e + ';1' | |
| 294 | }; | |
| 295 | ||
| 296 | var hdrSyn cStartJobs Value = [{ | |
| 297 | collec tion: 'syn cStart', | |
| 298 | pid: h drIdValue + ';1', | |
| 299 | metaSt amp: { | |
| 300 | st ampTime: ' 2015011411 5126', | |
| 301 | so urceMetaSt amp: { | |
| 302 | '84F0': { | |
| 303 | pid: hdrIdValu e + ';1', | |
| 304 | loca lId: '1', | |
| 305 | stam pTime: '20 1501141151 26', | |
| 306 | doma inMetaStam p: { | |
| 307 | 'allergy': { | |
| 308 | domain : 'allergy ', | |
| 309 | stampT ime: '2015 0114115126 ', | |
| 310 | eventM etaStamp: { | |
| 311 | 'u rn:va:alle rgy:84F0:1 :751': { | |
| 312 | stampTim e: '201501 14115126' | |
| 313 | }, | |
| 314 | 'u rn:va:alle rgy:84F0:1 :752': { | |
| 315 | stampTim e: '201501 14115126' | |
| 316 | } | |
| 317 | } | |
| 318 | } | |
| 319 | } | |
| 320 | } | |
| 321 | } | |
| 322 | } | |
| 323 | }, { | |
| 324 | collec tion: 'syn cStart', | |
| 325 | pid: h drIdValue + ';2', | |
| 326 | metaSt amp: { | |
| 327 | st ampTime: ' 2015011411 5126', | |
| 328 | so urceMetaSt amp: { | |
| 329 | '84F0': { | |
| 330 | pid: hdrIdValu e + ';2', | |
| 331 | loca lId: '1', | |
| 332 | stam pTime: '20 1501141151 26', | |
| 333 | doma inMetaStam p: { | |
| 334 | 'allergy': { | |
| 335 | domain : 'allergy ', | |
| 336 | stampT ime: '2015 0114115126 ', | |
| 337 | eventM etaStamp: { | |
| 338 | 'u rn:va:alle rgy:84F0:2 :300': { | |
| 339 | stampTim e: '201501 14115126' | |
| 340 | }, | |
| 341 | 'u rn:va:alle rgy:84F0:2 :301': { | |
| 342 | stampTim e: '201501 14115126' | |
| 343 | } | |
| 344 | } | |
| 345 | } | |
| 346 | } | |
| 347 | } | |
| 348 | } | |
| 349 | } | |
| 350 | }]; | |
| 351 | ||
| 352 | var discha rgeNotific ation = { | |
| 353 | collec tion: 'dis charge', | |
| 354 | pid: ' 9E7A;3', | |
| 355 | system Id: '9E7A' , | |
| 356 | localI d: '3', | |
| 357 | icn: ' -1^NO ICN' , | |
| 358 | unsoli citedUpdat e: true, | |
| 359 | object : { | |
| 360 | de ceased: tr ue, | |
| 361 | la stUpdateTi me: '20170 517094313' , | |
| 362 | fa cilityCode : '998', | |
| 363 | fa cilityName : 'ABILENE (CAA)', | |
| 364 | ki nd: 'disch arge', | |
| 365 | re asonName: 'CHEST PAI N', | |
| 366 | st ampTime: ' 2017051709 4313', | |
| 367 | ui d: 'urn:va :discharge :9E7A:3:H4 654' | |
| 368 | } | |
| 369 | }; | |
| 370 | ||
| 371 | var discha rgeSyncSta rt = { | |
| 372 | collec tion: 'syn cStart', | |
| 373 | metaSt amp: { | |
| 374 | pi d: '9E7A;3 ', | |
| 375 | so urceMetaSt amp: { | |
| 376 | '9E7A': { | |
| 377 | doma inMetaStam p: { | |
| 378 | discharge: { | |
| 379 | domain : 'dischar ge', | |
| 380 | eventM etaStamp: { | |
| 381 | 'u rn:va:disc harge:9E7A :3:H4654': { | |
| 382 | stampTim e: 2017051 8092221 | |
| 383 | } | |
| 384 | }, | |
| 385 | stampT ime: 20170 518092221 | |
| 386 | } | |
| 387 | }, | |
| 388 | pid: '9E7A;3', | |
| 389 | stam pTime: 201 7051809222 1 | |
| 390 | } | |
| 391 | } | |
| 392 | }, | |
| 393 | pid: ' 9E7A;3', | |
| 394 | unsoli citedUpdat e: true | |
| 395 | }; | |
| 396 | ||
| 397 | var hdrDat aValue = { | |
| 398 | lastUp date: last UpdateTime Value, | |
| 399 | items: [] | |
| 400 | }; | |
| 401 | ||
| 402 | var vistaH drDataJobV alue = [{ | |
| 403 | collec tion: 'con sult', | |
| 404 | pid: ' 84F0;1', | |
| 405 | localI d: '1', | |
| 406 | seq: 1 , | |
| 407 | total: 1, | |
| 408 | object : { | |
| 409 | last UpdateTime : 20140409 083720, | |
| 410 | cate gory: 'P', | |
| 411 | uid: 'urn:va:c onsult:84F 0:1:82' | |
| 412 | } | |
| 413 | }, | |
| 414 | { | |
| 415 | collec tion: 'cpt ', | |
| 416 | pid: ' 84F0;1', | |
| 417 | localI d: '1', | |
| 418 | seq: 1 , | |
| 419 | total: 1, | |
| 420 | object : { | |
| 421 | last UpdateTime : 20140409 083720, | |
| 422 | type : 'U', | |
| 423 | uid: 'urn:va:c pt:84F0:1: 881' | |
| 424 | } | |
| 425 | } | |
| 426 | ]; | |
| 427 | ||
| 428 | hdrDataVal ue.items = hdrSyncSt artJobsVal ue.concat( vistaHdrDa taJobValue ); | |
| 429 | ||
| 430 | describe(' VistaRecor dProcessor ', functio n() { | |
| 431 | before Each(funct ion() { | |
| 432 | // Underlyin g JDS call s to monit or and mak e sure tha t they are made. | |
| 433 | // ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 434 | // spyOn(jds ClientDumm y, 'storeO perational Data').and CallThroug h(); | |
| 435 | // spyOn(jds ClientDumm y, 'getOpe rationalDa taByUid'). andCallThr ough(); | |
| 436 | ||
| 437 | sp yOn(jdsCli entDummy, 'storeOper ationalDat aMutable') .andCallTh rough(); | |
| 438 | sp yOn(jdsCli entDummy, 'getOperat ionalDataM utable').a ndCallThro ugh(); | |
| 439 | ||
| 440 | sp yOn(jdsCli entDummy, 'saveSyncS tatus').an dCallThrou gh(); | |
| 441 | sp yOn(jdsCli entDummy, 'saveOpera tionalSync Status').a ndCallThro ugh(); | |
| 442 | sp yOn(jdsCli entDummy, 'getPatien tIdentifie rByPid').a ndCallThro ugh(); | |
| 443 | sp yOn(jdsCli entDummy, 'saveJobSt ate').andC allThrough (); | |
| 444 | sp yOn(jdsCli entDummy, 'childInst ance').and CallThroug h(); | |
| 445 | sp yOn(proces sor, '_pro cessDataIt em').andCa llThrough( ); | |
| 446 | sp yOn(proces sor, '_bui ldVistaDat aJob').and CallThroug h(); | |
| 447 | sp yOn(proces sor, '_han dleItemErr or').andCa llThrough( ); | |
| 448 | // spyOn(proc essor, '_p rocessVist aDataJobs' ).andCallT hrough(); | |
| 449 | sp yOn(proces sor, '_pro cessVistaD ataJob').a ndCallThro ugh(); | |
| 450 | // spyOn(proc essor, '_p rocessSync StartJobs' ).andCallT hrough(); | |
| 451 | sp yOn(proces sor, '_pro cessSyncSt artJob').a ndCallThro ugh(); | |
| 452 | // spyOn(proc essor, '_p rocessOPDS yncStartJo bs').andCa llThrough( ); | |
| 453 | sp yOn(proces sor, '_pro cessOPDSyn cStartJob' ).andCallT hrough(); | |
| 454 | sp yOn(proces sor, '_sto reMetaStam p').andCal lThrough() ; | |
| 455 | sp yOn(proces sor, '_sto reOperatio nalMetaSta mp').andCa llThrough( ); | |
| 456 | sp yOn(proces sor, '_sto reComplete dJob').and CallThroug h(); | |
| 457 | sp yOn(hdrpro cessor, '_ storeCompl etedJob'). andCallThr ough(); | |
| 458 | sp yOn(publis herRouterD ummy, 'pub lish').and CallThroug h(); | |
| 459 | sp yOn(errorP ublisher, 'publishPo llerError' ).andCallT hrough(); | |
| 460 | sp yOn(publis herRouterD ummy, 'chi ldInstance ').andCall Through(); | |
| 461 | sp yOn(dummyL ogger, 'ch ild').andC allThrough (); | |
| 462 | sp yOn(enviro nment.jobS tatusUpdat er, 'child Instance') .andCallTh rough(); | |
| 463 | }); | |
| 464 | ||
| 465 | descri be('operat ional data ', functio n() { | |
| 466 | it ('Null Rec ord', func tion() { | |
| 467 | var reco rd = null; | |
| 468 | expect(p rocessor._ isOperatio nalData(re cord)).toB eFalsy(); | |
| 469 | }) ; | |
| 470 | it ('Empty It ems', func tion() { | |
| 471 | var reco rd = {}; | |
| 472 | expect(p rocessor._ isOperatio nalData(re cord)).toB eTruthy(); | |
| 473 | }) ; | |
| 474 | it ('PID Reco rd', funct ion() { | |
| 475 | var reco rd = { | |
| 476 | pid: '1' | |
| 477 | }; | |
| 478 | expect(p rocessor._ isOperatio nalData(re cord)).toB eFalsy(); | |
| 479 | }) ; | |
| 480 | it ('Good Ope rational R ecord', fu nction() { | |
| 481 | var reco rd = { | |
| 482 | coll ection: 'p atient' | |
| 483 | }; | |
| 484 | expect(p rocessor._ isOperatio nalData(re cord)).toB eTruthy(); | |
| 485 | }) ; | |
| 486 | it ('Developm ent Operat ional Samp les', func tion() { | |
| 487 | //iterat es over al l sample o perational data and confirms t hat isOper ational is true | |
| 488 | var dire ctory = 't ests/data/ operationa l'; | |
| 489 | director y = path.r esolve(dir ectory); | |
| 490 | fs.readd ir(directo ry, functi on(err, li st) { | |
| 491 | expe ct(err).to BeFalsy(); | |
| 492 | if ( err) { | |
| 493 | return; | |
| 494 | } | |
| 495 | ||
| 496 | asyn c.eachSeri es(list, f unction(fi le, callba ck) { | |
| 497 | var path = directory + '/' + f ile; | |
| 498 | var conten ts = fs.re adFileSync (path); | |
| 499 | try { | |
| 500 | conten ts = JSON. parse(cont ents); | |
| 501 | expect (contents) .not.toBeU ndefined() ; | |
| 502 | expect (contents. data).not. toBeUndefi ned(); | |
| 503 | expect (contents. data.items ).not.toBe Undefined( ); | |
| 504 | ||
| 505 | var it ems = cont ents.data. items; | |
| 506 | async. eachSeries (items, fu nction(ope rationalPa yload, cal lback) { | |
| 507 | ex pect(proce ssor._isOp erationalD ata(operat ionalPaylo ad)).toBeT ruthy(); | |
| 508 | ca llback(); | |
| 509 | }); | |
| 510 | callba ck(); | |
| 511 | } catch (e ) { | |
| 512 | expect (e).toBeUn defined(); | |
| 513 | consol e.log(e); | |
| 514 | // con sole.log(' could not parse ' +f ile);x | |
| 515 | callba ck(e); | |
| 516 | } | |
| 517 | }); | |
| 518 | }); | |
| 519 | }) ; | |
| 520 | }); | |
| 521 | ||
| 522 | descri be('_isSyn cNotificat ion', func tion() { | |
| 523 | it ('Null dom ain', func tion() { | |
| 524 | var doma in = null; | |
| 525 | expect(p rocessor._ isSyncNoti fication(d omain)).to BeFalsy(); | |
| 526 | }) ; | |
| 527 | it ('Empty do main', fun ction() { | |
| 528 | var doma in = ''; | |
| 529 | expect(p rocessor._ isOperatio nalData(do main)).toB eFalsy(); | |
| 530 | }) ; | |
| 531 | it ('not a sy nc notific ation doma in', funct ion() { | |
| 532 | var doma in = 'alle rgy'; | |
| 533 | expect(p rocessor._ isSyncNoti fication(d omain)).to BeFalsy(); | |
| 534 | }) ; | |
| 535 | it ('is a syn c notifica tion domai n', functi on() { | |
| 536 | var doma in = 'disc harge'; | |
| 537 | expect(p rocessor._ isSyncNoti fication(d omain)).to BeTruthy() ; | |
| 538 | }) ; | |
| 539 | }); | |
| 540 | ||
| 541 | descri be('_proce ssDataItem ', functio n(){ | |
| 542 | it ('Normal p ath: syncS tart', fun ction(){ | |
| 543 | processo r._process DataItem(s yncStartJo bsValue[0] , function (){ | |
| 544 | expe ct(process or._proces sSyncStart Job).toHav eBeenCalle d(); | |
| 545 | }); | |
| 546 | }) ; | |
| 547 | it ('Normal p ath: OPDsy ncStart', function() { | |
| 548 | processo r._process DataItem(O PDsyncStar tJobsValue [0], funct ion(){ | |
| 549 | expe ct(process or._proces sOPDSyncSt artJob).to HaveBeenCa lled(); | |
| 550 | }); | |
| 551 | }) ; | |
| 552 | it ('Normal p ath: vista DataJob', function() { | |
| 553 | processo r._process DataItem(v istaDataJo bsValue[0] , function (){ | |
| 554 | expe ct(process or._proces sVistaData Job).toHav eBeenCalle d(); | |
| 555 | }); | |
| 556 | }) ; | |
| 557 | it ('Normal p ath: vista DataJob (E mpty objec t)', funct ion(){ | |
| 558 | processo r._process DataItem({ collection : 'allergy ', object: null}, fu nction(err or, respon se){ | |
| 559 | expe ct(process or._proces sVistaData Job).not.t oHaveBeenC alled(); | |
| 560 | expe ct(error). toBeNull() ; | |
| 561 | expe ct(respons e).toEqual ('Item of collection type alle rgy has no data to p rocess'); | |
| 562 | }); | |
| 563 | }) ; | |
| 564 | it ('Normal p ath: Recei ved item l evel error ', functio n(){ | |
| 565 | processo r._process DataItem(v istaErrorI tem, funct ion(error, response) { | |
| 566 | expe ct(process or._proces sVistaData Job).not.t oHaveBeenC alled(); | |
| 567 | expe ct(process or._handle ItemError) .toHaveBee nCalled(); | |
| 568 | expe ct(errorPu blisher.pu blishPolle rError).to HaveBeenCa lled(); | |
| 569 | expe ct(error). toBeNull() ; | |
| 570 | expe ct(respons e).toConta in('A sing le item fr om a Vista Batch had an error' ); | |
| 571 | }); | |
| 572 | }) ; | |
| 573 | }); | |
| 574 | ||
| 575 | descri be('_handl eItemError ', functio n(){ | |
| 576 | it ('Normal p ath:', fun ction(){ | |
| 577 | processo r._handleI temError(v istaErrorI tem, funct ion(error, response) { | |
| 578 | expe ct(errorPu blisher.pu blishPolle rError).to HaveBeenCa lledWith(' 9E7A', vis taErrorIte m, jasmine .any(Strin g), jasmin e.any(Func tion)); | |
| 579 | expe ct(error). toBeNull() ; | |
| 580 | expe ct(respons e).toConta in('A sing le item fr om a Vista Batch had an error' ); | |
| 581 | }); | |
| 582 | }) ; | |
| 583 | it ('Error Pa th: Item w as null', function() { | |
| 584 | processo r._handleI temError(n ull, funct ion(error, response) { | |
| 585 | expe ct(errorPu blisher.pu blishPolle rError).no t.toHaveBe enCalled() ; | |
| 586 | expe ct(error). toBeNull() ; | |
| 587 | expe ct(respons e).toConta in('Method called wi th null or undefined item'); | |
| 588 | }); | |
| 589 | }) ; | |
| 590 | it ('Error pa th: Item d id not con tain an er ror node.' , function (){ | |
| 591 | processo r._handleI temError({ }, functio n(error, r esponse){ | |
| 592 | expe ct(errorPu blisher.pu blishPolle rError).no t.toHaveBe enCalled() ; | |
| 593 | expe ct(error). toBeNull() ; | |
| 594 | expe ct(respons e).toConta in('Method called wi th item th at did not contain a n error.') ; | |
| 595 | }); | |
| 596 | }) ; | |
| 597 | it ('Error pa th: Item E rror did n ot have an y UID.', f unction(){ | |
| 598 | var loca lItem = JS ON.parse(J SON.string ify(vistaE rrorItem)) ; | |
| 599 | delete l ocalItem.e rror[0].ui d; | |
| 600 | processo r._handleI temError(l ocalItem, function(e rror, resp onse){ | |
| 601 | expe ct(errorPu blisher.pu blishPolle rError).to HaveBeenCa lledWith(u ndefined, localItem, jasmine.a ny(String) , jasmine. any(Functi on)); | |
| 602 | expe ct(error). toBeNull() ; | |
| 603 | expe ct(respons e).toConta in('A sing le item fr om a Vista Batch had an error' ); | |
| 604 | }); | |
| 605 | }) ; | |
| 606 | it ('Error pa th: Item E rror conta ins multip le errors and the se cond error contains a UID.', f unction(){ | |
| 607 | var loca lItem = JS ON.parse(J SON.string ify(vistaE rrorItem)) ; | |
| 608 | delete l ocalItem.e rror[0].ui d; | |
| 609 | localIte m.error[1] = JSON.pa rse(JSON.s tringify(v istaErrorI tem.error[ 0])); | |
| 610 | processo r._handleI temError(l ocalItem, function(e rror, resp onse){ | |
| 611 | expe ct(errorPu blisher.pu blishPolle rError).to HaveBeenCa lledWith(' 9E7A', loc alItem, ja smine.any( String), j asmine.any (Function) ); | |
| 612 | expe ct(error). toBeNull() ; | |
| 613 | expe ct(respons e).toConta in('A sing le item fr om a Vista Batch had an error' ); | |
| 614 | }); | |
| 615 | }) ; | |
| 616 | }); | |
| 617 | ||
| 618 | descri be('_proce ssVistaDat aJob', fun ction() { | |
| 619 | it ('Happy Pa th', funct ion() { | |
| 620 | var expe ctedJdsRes ponse = { | |
| 621 | stat usCode: 20 1 | |
| 622 | }; | |
| 623 | jdsClien tDummy._se tResponseD ata(null, expectedJd sResponse, undefined ); | |
| 624 | ||
| 625 | var fini shed = fal se; | |
| 626 | var actu alError; | |
| 627 | var actu alResponse ; | |
| 628 | runs(fun ction() { | |
| 629 | proc essor._pro cessVistaD ataJob(vis taDataJobs Value[0], function(e rror, resp onse) { | |
| 630 | actualErro r = error; | |
| 631 | actualResp onse = res ponse; | |
| 632 | finished = true; | |
| 633 | }); | |
| 634 | }); | |
| 635 | ||
| 636 | waitsFor (function( ) { | |
| 637 | retu rn finishe d; | |
| 638 | }, 'Call to _proce ssVistaDat aJobs fail ed to retu rn in time .', 500); | |
| 639 | ||
| 640 | runs(fun ction() { | |
| 641 | expe ct(actualE rror).toBe Falsy(); | |
| 642 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 643 | expe ct(process or._buildV istaDataJo b.calls.le ngth).toEq ual(1); | |
| 644 | expe ct(process or._buildV istaDataJo b).toHaveB eenCalledW ith(dummyL ogger, jas mine.objec tContainin g(vistaDat aJobsValue [0])); | |
| 645 | expe ct(publish erRouterDu mmy.childI nstance.ca lls.length ).toEqual( 1); | |
| 646 | expe ct(publish erRouterDu mmy.childI nstance).t oHaveBeenC alledWith( dummyLogge r); | |
| 647 | expe ct(publish erRouterDu mmy.publis h.calls.le ngth).toEq ual(1); | |
| 648 | expe ct(publish erRouterDu mmy.publis h).toHaveB eenCalledW ith( | |
| 649 | jasmin e.objectCo ntaining({ | |
| 650 | ty pe: 'event -prioritiz ation-requ est', | |
| 651 | pa tientIdent ifier: { | |
| 652 | type: 'p id', | |
| 653 | value: ' C877;1' | |
| 654 | }, | |
| 655 | da taDomain: 'allergy', | |
| 656 | re cord: { | |
| 657 | pid: 'C8 77;1', | |
| 658 | uid: 'ur n:va:aller gy:9E7A:1: 27837' | |
| 659 | } | |
| 660 | }), | |
| 661 | jasmine.an y(Function )); | |
| 662 | }); | |
| 663 | }) ; | |
| 664 | it ('Sync Not ification Path', fun ction() { | |
| 665 | var fini shed = fal se; | |
| 666 | var actu alError; | |
| 667 | var actu alResponse ; | |
| 668 | runs(fun ction() { | |
| 669 | proc essor._pro cessVistaD ataJob(dis chargeNoti fication, function(e rror, resp onse) { | |
| 670 | actualErro r = error; | |
| 671 | actualResp onse = res ponse; | |
| 672 | finished = true; | |
| 673 | }); | |
| 674 | }); | |
| 675 | ||
| 676 | waitsFor (function( ) { | |
| 677 | retu rn finishe d; | |
| 678 | }, 'Call to _proce ssVistaDat aJobs fail ed to retu rn in time .', 500); | |
| 679 | ||
| 680 | runs(fun ction() { | |
| 681 | expe ct(actualE rror).toBe Falsy(); | |
| 682 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 683 | expe ct(process or._buildV istaDataJo b.calls.le ngth).toEq ual(1); | |
| 684 | expe ct(process or._buildV istaDataJo b).toHaveB eenCalledW ith(dummyL ogger, jas mine.objec tContainin g(discharg eNotificat ion)); | |
| 685 | expe ct(publish erRouterDu mmy.childI nstance.ca lls.length ).toEqual( 1); | |
| 686 | expe ct(publish erRouterDu mmy.childI nstance).t oHaveBeenC alledWith( dummyLogge r); | |
| 687 | expe ct(publish erRouterDu mmy.publis h.calls.le ngth).toEq ual(1); | |
| 688 | expe ct(publish erRouterDu mmy.publis h).toHaveB eenCalledW ith( | |
| 689 | jasmine.ob jectContai ning({ | |
| 690 | type: 'sync-noti fication', | |
| 691 | patien tIdentifie r: { | |
| 692 | ty pe: 'pid', | |
| 693 | va lue: '9E7A ;3' | |
| 694 | }, | |
| 695 | dataDo main: 'dis charge', | |
| 696 | record : { | |
| 697 | de ceased: tr ue, | |
| 698 | la stUpdateTi me: '20170 517094313' , | |
| 699 | fa cilityCode : '998', | |
| 700 | fa cilityName : 'ABILENE (CAA)', | |
| 701 | ki nd: 'disch arge', | |
| 702 | re asonName: 'CHEST PAI N', | |
| 703 | st ampTime: ' 2017051709 4313', | |
| 704 | ui d: 'urn:va :discharge :9E7A:3:H4 654', | |
| 705 | pi d : '9E7A; 3' | |
| 706 | } | |
| 707 | }), | |
| 708 | jasmine.an y(Function )); | |
| 709 | }); | |
| 710 | }) ; | |
| 711 | }); | |
| 712 | ||
| 713 | descri be('_build VistaDataJ ob', funct ion() { | |
| 714 | it ('Patient Data Job', function( ) { | |
| 715 | var job = processo r._buildVi staDataJob (dummyLogg er, vistaD ataJobsVal ue[0]); | |
| 716 | ||
| 717 | expect(j ob).toBeTr uthy(); | |
| 718 | expect(j ob).toEqua l(jasmine. objectCont aining({ | |
| 719 | type : 'event-p rioritizat ion-reques t', | |
| 720 | pati entIdentif ier: { | |
| 721 | type: 'pid ', | |
| 722 | value: 'C8 77;1' | |
| 723 | }, | |
| 724 | data Domain: 'a llergy', | |
| 725 | reco rd: { | |
| 726 | pid: 'C877 ;1', | |
| 727 | uid: 'urn: va:allergy :9E7A:1:27 837' | |
| 728 | }, | |
| 729 | prio rity: 1, | |
| 730 | refe renceInfo: { | |
| 731 | 'requestId ': 'req123 4', | |
| 732 | 'sessionId ': 'sess12 34' | |
| 733 | }, | |
| 734 | root JobId: '11 ' | |
| 735 | })); | |
| 736 | // Make sure that the origin al job ID did not sn eak in the new job. | |
| 737 | //------ ---------- ---------- ---------- ---------- ---------- --------- | |
| 738 | expect(j ob).not.to Equal(jasm ine.object Containing ({ | |
| 739 | jobI d: '11-1' | |
| 740 | })); | |
| 741 | }) ; | |
| 742 | it ('Patient Data Job ( Unsolicite d Update)' , function () { | |
| 743 | var loca lVistaData JobValue = JSON.pars e(JSON.str ingify(vis taDataJobs Value[0])) ; | |
| 744 | delete l ocalVistaD ataJobValu e.referenc eInfo; | |
| 745 | localVis taDataJobV alue.unsol icitedUpda te = true; | |
| 746 | var job = processo r._buildVi staDataJob (dummyLogg er, localV istaDataJo bValue); | |
| 747 | ||
| 748 | expect(j ob).toBeTr uthy(); | |
| 749 | expect(j ob).toEqua l(jasmine. objectCont aining({ | |
| 750 | type : 'event-p rioritizat ion-reques t', | |
| 751 | pati entIdentif ier: { | |
| 752 | type: 'pid ', | |
| 753 | value: 'C8 77;1' | |
| 754 | }, | |
| 755 | data Domain: 'a llergy', | |
| 756 | reco rd: { | |
| 757 | pid: 'C877 ;1', | |
| 758 | uid: 'urn: va:allergy :9E7A:1:27 837' | |
| 759 | }, | |
| 760 | prio rity: 1, | |
| 761 | refe renceInfo: { | |
| 762 | 'initialSy ncId': 'C8 77;1' | |
| 763 | } | |
| 764 | })); | |
| 765 | // Make sure that the origin al job ID did not sn eak in the new job. | |
| 766 | //------ ---------- ---------- ---------- ---------- ---------- --------- | |
| 767 | expect(j ob).not.to Equal(jasm ine.object Containing ({ | |
| 768 | jobI d: '11-1' | |
| 769 | })); | |
| 770 | }) ; | |
| 771 | it ('Patient Data Job ( Old system - unsolic itedUpdate is undefi ned)', fun ction() { | |
| 772 | var loca lVistaData JobValue = JSON.pars e(JSON.str ingify(vis taDataJobs Value[0])) ; | |
| 773 | delete l ocalVistaD ataJobValu e.referenc eInfo; | |
| 774 | var job = processo r._buildVi staDataJob (dummyLogg er, localV istaDataJo bValue); | |
| 775 | ||
| 776 | expect(j ob).toBeTr uthy(); | |
| 777 | expect(j ob).toEqua l(jasmine. objectCont aining({ | |
| 778 | type : 'event-p rioritizat ion-reques t', | |
| 779 | pati entIdentif ier: { | |
| 780 | type: 'pid ', | |
| 781 | value: 'C8 77;1' | |
| 782 | }, | |
| 783 | data Domain: 'a llergy', | |
| 784 | reco rd: { | |
| 785 | pid: 'C877 ;1', | |
| 786 | uid: 'urn: va:allergy :9E7A:1:27 837' | |
| 787 | } | |
| 788 | })); | |
| 789 | // Make sure that the origin al job ID did not sn eak in the new job. | |
| 790 | //------ ---------- ---------- ---------- ---------- ---------- --------- | |
| 791 | expect(j ob).not.to Equal(jasm ine.object Containing ({ | |
| 792 | jobI d: '11-1' | |
| 793 | })); | |
| 794 | expect(j ob.priorit y).toBeUnd efined(); | |
| 795 | expect(j ob.referen ceInfo).to BeUndefine d(); | |
| 796 | }) ; | |
| 797 | it ('Operatio nal Data p t-select', function( ) { | |
| 798 | var job = processo r._buildVi staDataJob (dummyLogg er, vistaD ataJobsVal ue[1]); | |
| 799 | ||
| 800 | expect(j ob).toBeTr uthy(); | |
| 801 | expect(j ob).toEqua l(jasmine. objectCont aining({ | |
| 802 | type : 'operati onal-store -record', | |
| 803 | reco rd: { | |
| 804 | pid: 'C877 ;2' | |
| 805 | } | |
| 806 | })); | |
| 807 | expect(j ob).not.to Equal(jasm ine.object Containing ({ | |
| 808 | prio rity: 1, | |
| 809 | refe renceInfo: { | |
| 810 | 'requestId ': 'req123 4', | |
| 811 | 'sessionId ': 'sess12 34' | |
| 812 | }, | |
| 813 | root JobId: '11 ' | |
| 814 | })); | |
| 815 | }) ; | |
| 816 | it ('Operatio nal Data o ther', fun ction() { | |
| 817 | var job = processo r._buildVi staDataJob (dummyLogg er, vistaD ataJobsVal ue[2]); | |
| 818 | ||
| 819 | expect(j ob).toBeTr uthy(); | |
| 820 | expect(j ob).toEqua l(jasmine. objectCont aining({ | |
| 821 | type : 'operati onal-store -record', | |
| 822 | reco rd: { | |
| 823 | data: 'som e operatio nal data' | |
| 824 | } | |
| 825 | })); | |
| 826 | }) ; | |
| 827 | it ('Sync Not ification Job', func tion() { | |
| 828 | var job = processo r._buildVi staDataJob (dummyLogg er, discha rgeNotific ation); | |
| 829 | ||
| 830 | expect(j ob).toBeTr uthy(); | |
| 831 | expect(j ob).toEqua l(jasmine. objectCont aining({ | |
| 832 | type : 'sync-no tification ', | |
| 833 | time stamp : ja smine.any( String), | |
| 834 | pati entIdentif ier: { | |
| 835 | type: 'pid ', | |
| 836 | value: '9E 7A;3' | |
| 837 | }, | |
| 838 | prio rity : 1, | |
| 839 | refe renceInfo : { initia lSyncId : '9E7A;3' } , | |
| 840 | data Domain: 'd ischarge', | |
| 841 | reco rd: { | |
| 842 | deceased: true, | |
| 843 | lastUpdate Time: '201 7051709431 3', | |
| 844 | facilityCo de: '998', | |
| 845 | facilityNa me: 'ABILE NE (CAA)', | |
| 846 | kind: 'dis charge', | |
| 847 | reasonName : 'CHEST P AIN', | |
| 848 | stampTime: '20170517 094313', | |
| 849 | uid: 'urn: va:dischar ge:9E7A:3: H4654', | |
| 850 | pid : '9E7 A;3' | |
| 851 | } | |
| 852 | })); | |
| 853 | }) ; | |
| 854 | }); | |
| 855 | descri be('proces sBatch', f unction() { | |
| 856 | du mmyLogger. info('Now starting p rocessBatc h test'); | |
| 857 | it ('Happy Pa th', funct ion() { | |
| 858 | var expe ctedJdsRes ponse = [{ | |
| 859 | stat usCode: 20 0 | |
| 860 | },{ | |
| 861 | stat usCode: 20 0 | |
| 862 | }]; | |
| 863 | jdsClien tDummy._se tResponseD ata(null, expectedJd sResponse, undefined ); | |
| 864 | ||
| 865 | var fini shed = fal se; | |
| 866 | var actu alError; | |
| 867 | var actu alResponse ; | |
| 868 | runs(fun ction() { | |
| 869 | proc essor.proc essBatch(d ataValue, function(e rror, resp onse) { | |
| 870 | dummyLogge r.debug('a rrived in the callba ck.'); | |
| 871 | actualErro r = error; | |
| 872 | actualResp onse = res ponse; | |
| 873 | finished = true; | |
| 874 | dummyLogge r.debug('e nd of call back.'); | |
| 875 | }); | |
| 876 | }); | |
| 877 | ||
| 878 | waitsFor (function( ) { | |
| 879 | retu rn finishe d; | |
| 880 | }, 'Call to _proce ssBatch fa iled to re turn in ti me.', 1000 ); | |
| 881 | ||
| 882 | runs(fun ction() { | |
| 883 | expe ct(actualE rror).toBe Falsy(); | |
| 884 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 885 | expe ct(process or._proces sSyncStart Job.calls. length).to Equal(2); | |
| 886 | expe ct(process or._proces sVistaData Job.calls. length).to Equal(3); | |
| 887 | expe ct(publish erRouterDu mmy.publis h.calls.le ngth).toEq ual(3); | |
| 888 | expe ct(publish erRouterDu mmy.publis h).toHaveB eenCalledW ith(jasmin e.any(Obje ct), jasmi ne.any(Fun ction)); | |
| 889 | }); | |
| 890 | }) ; | |
| 891 | }); | |
| 892 | descri be('_proce ssSyncStar tJob', fun ction() { | |
| 893 | it ('Happy Pa th', funct ion() { | |
| 894 | var expe ctedJdsRes ponse = { | |
| 895 | stat usCode: 20 0 | |
| 896 | }; | |
| 897 | jdsClien tDummy._se tResponseD ata(null, expectedJd sResponse, undefined ); | |
| 898 | ||
| 899 | var fini shed = fal se; | |
| 900 | var actu alError; | |
| 901 | var actu alResponse ; | |
| 902 | runs(fun ction() { | |
| 903 | proc essor._pro cessSyncSt artJob(syn cStartJobs Value[0], function(e rror, resp onse) { | |
| 904 | actualErro r = error; | |
| 905 | actualResp onse = res ponse; | |
| 906 | finished = true; | |
| 907 | }); | |
| 908 | }); | |
| 909 | ||
| 910 | waitsFor (function( ) { | |
| 911 | retu rn finishe d; | |
| 912 | }, 'Call to _proce ssSyncStar tJobs fail ed to retu rn in time .', 500); | |
| 913 | ||
| 914 | runs(fun ction() { | |
| 915 | expe ct(actualE rror).toBe Falsy(); | |
| 916 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 917 | expe ct(dummyLo gger.child ).toHaveBe enCalledWi th(syncSta rtJobsValu e[0].refer enceInfo); | |
| 918 | expe ct(jdsClie ntDummy.sa veSyncStat us.calls.l ength).toE qual(1); | |
| 919 | expe ct(jdsClie ntDummy.sa veSyncStat us).toHave BeenCalled With(syncS tartJobsVa lue[0].met aStamp, pa tientIdent ifierValue 1, jasmine .any(Funct ion)); | |
| 920 | }); | |
| 921 | }) ; | |
| 922 | it ('Happy Pa th (Empty metaStamp) ', functio n() { | |
| 923 | var expe ctedJdsRes ponse = { | |
| 924 | stat usCode: 20 0 | |
| 925 | }; | |
| 926 | jdsClien tDummy._se tResponseD ata(null, expectedJd sResponse, undefined ); | |
| 927 | ||
| 928 | var fini shed = fal se; | |
| 929 | var actu alError; | |
| 930 | var actu alResponse ; | |
| 931 | runs(fun ction() { | |
| 932 | proc essor._pro cessSyncSt artJob(syn cStartJobE mptyMetast amp, funct ion(error, response) { | |
| 933 | actualErro r = error; | |
| 934 | actualResp onse = res ponse; | |
| 935 | finished = true; | |
| 936 | }); | |
| 937 | }); | |
| 938 | ||
| 939 | waitsFor (function( ) { | |
| 940 | retu rn finishe d; | |
| 941 | }, 'Call to _proce ssSyncStar tJobs fail ed to retu rn in time .', 500); | |
| 942 | ||
| 943 | runs(fun ction() { | |
| 944 | expe ct(actualE rror).toBe Falsy(); | |
| 945 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 946 | expe ct(dummyLo gger.child ).toHaveBe enCalledWi th(syncSta rtJobEmpty Metastamp. referenceI nfo); | |
| 947 | expe ct(jdsClie ntDummy.sa veSyncStat us.calls.l ength).toE qual(0); | |
| 948 | //ex pect(jdsCl ientDummy. saveSyncSt atus).toHa veBeenCall edWith(syn cStartJobs Value[0].m etaStamp, patientIde ntifierVal ue1, jasmi ne.any(Fun ction)); | |
| 949 | }); | |
| 950 | }) ; | |
| 951 | it ('Sync Not ification Path', fun ction() { | |
| 952 | var fini shed = fal se; | |
| 953 | var actu alError; | |
| 954 | var actu alResponse ; | |
| 955 | runs(fun ction() { | |
| 956 | proc essor._pro cessSyncSt artJob(dis chargeSync Start, fun ction(erro r, respons e) { | |
| 957 | actualErro r = error; | |
| 958 | actualResp onse = res ponse; | |
| 959 | finished = true; | |
| 960 | }); | |
| 961 | }); | |
| 962 | ||
| 963 | waitsFor (function( ) { | |
| 964 | retu rn finishe d; | |
| 965 | }, 'Call to _proce ssSyncStar tJobs fail ed to retu rn in time .', 500); | |
| 966 | ||
| 967 | runs(fun ction() { | |
| 968 | expe ct(actualE rror).toBe Falsy(); | |
| 969 | expe ct(actualR esponse).t oBeFalsy() ; | |
| 970 | expe ct(jdsClie ntDummy.sa veSyncStat us).not.to HaveBeenCa lled(); | |
| 971 | }); | |
| 972 | }) ; | |
| 973 | it ('No pid', function( ) { | |
| 974 | var sync StartJobNo Pid = { | |
| 975 | coll ection: 's yncStart', | |
| 976 | meta Stamp: { | |
| 977 | stampTime: '20150114 115126', | |
| 978 | sourceMeta Stamp: { | |
| 979 | '9E7A' : { | |
| 980 | pi d: vistaId Value + '; 1', | |
| 981 | lo calId: '1' , | |
| 982 | st ampTime: ' 2015011411 5126', | |
| 983 | do mainMetaSt amp: { | |
| 984 | 'allergy ': { | |
| 985 | doma in: 'aller gy', | |
| 986 | stam pTime: '20 1501141151 26', | |
| 987 | even tMetaStamp : { | |
| 988 | 'urn:va:al lergy:C877 :1:751': { | |
| 989 | stampT ime: '2015 0114115126 ' | |
| 990 | }, | |
| 991 | 'urn:va:al lergy:C877 :1:752': { | |
| 992 | stampT ime: '2015 0114115126 ' | |
| 993 | } | |
| 994 | } | |
| 995 | } | |
| 996 | } | |
| 997 | } | |
| 998 | } | |
| 999 | } | |
| 1000 | }; | |
| 1001 | var fini shed = fal se; | |
| 1002 | var actu alError; | |
| 1003 | var actu alResponse ; | |
| 1004 | runs(fun ction() { | |
| 1005 | proc essor._pro cessSyncSt artJob(syn cStartJobN oPid, func tion(error , response ) { | |
| 1006 | actualErro r = error; | |
| 1007 | actualResp onse = res ponse; | |
| 1008 | finished = true; | |
| 1009 | }); | |
| 1010 | }); | |
| 1011 | ||
| 1012 | waitsFor (function( ) { | |
| 1013 | retu rn finishe d; | |
| 1014 | }, 'Call to _proce ssSyncStar tJobs fail ed to retu rn in time .', 500); | |
| 1015 | ||
| 1016 | runs(fun ction() { | |
| 1017 | expe ct(actualE rror).toBe Null(); | |
| 1018 | expe ct(actualR esponse).t oBe('Faile dNoPid'); | |
| 1019 | expe ct(dummyLo gger.child ).not.toHa veBeenCall ed(); | |
| 1020 | expe ct(jdsClie ntDummy.sa veSyncStat us.calls.l ength).toE qual(0); | |
| 1021 | }); | |
| 1022 | }) ; | |
| 1023 | it ('No metaS tamp', fun ction() { | |
| 1024 | var sync StartJobNo Pid = { | |
| 1025 | coll ection: 's yncStart', | |
| 1026 | pid: vistaIdVa lue + ';1' | |
| 1027 | }; | |
| 1028 | var fini shed = fal se; | |
| 1029 | var actu alError; | |
| 1030 | var actu alResponse ; | |
| 1031 | runs(fun ction() { | |
| 1032 | proc essor._pro cessSyncSt artJob(syn cStartJobN oPid, func tion(error , response ) { | |
| 1033 | actualErro r = error; | |
| 1034 | actualResp onse = res ponse; | |
| 1035 | finished = true; | |
| 1036 | }); | |
| 1037 | }); | |
| 1038 | ||
| 1039 | waitsFor (function( ) { | |
| 1040 | retu rn finishe d; | |
| 1041 | }, 'Call to _proce ssSyncStar tJob faile d to retur n in time. ', 500); | |
| 1042 | ||
| 1043 | runs(fun ction() { | |
| 1044 | expe ct(actualE rror).toBe Null(); | |
| 1045 | expe ct(actualR esponse).t oBe(null); | |
| 1046 | expe ct(dummyLo gger.child ).not.toHa veBeenCall ed(); | |
| 1047 | expe ct(jdsClie ntDummy.sa veSyncStat us.calls.l ength).toE qual(0); | |
| 1048 | }); | |
| 1049 | }) ; | |
| 1050 | }); | |
| 1051 | ||
| 1052 | descri be('_proce ssOPDSyncS tartJob', function() { | |
| 1053 | it ('Happy Pa th', funct ion() { | |
| 1054 | var expe ctedJdsRes ponse = { | |
| 1055 | stat usCode: 20 0 | |
| 1056 | }; | |
| 1057 | //var jd sClientDum my = new J dsClientDu mmy(dummyL ogger, con fig); | |
| 1058 | jdsClien tDummy._se tResponseD ata(null, expectedJd sResponse, undefined ); | |
| 1059 | //spyOn( jdsClientD ummy, 'sav eOperation alSyncStat us').andCa llThrough( ); | |
| 1060 | ||
| 1061 | var fini shed = fal se; | |
| 1062 | var actu alError; | |
| 1063 | var actu alResponse ; | |
| 1064 | runs(fun ction() { | |
| 1065 | proc essor._pro cessOPDSyn cStartJob( OPDsyncSta rtJobsValu e[0], func tion(error , response ) { | |
| 1066 | actualErro r = error; | |
| 1067 | actualResp onse = res ponse; | |
| 1068 | finished = true; | |
| 1069 | }); | |
| 1070 | }); | |
| 1071 | ||
| 1072 | waitsFor (function( ) { | |
| 1073 | retu rn finishe d; | |
| 1074 | }, 'Call to _proce ssSyncStar tJobs fail ed to retu rn in time .', 500); | |
| 1075 | ||
| 1076 | runs(fun ction() { | |
| 1077 | expe ct(actualE rror).toBe Falsy(); | |
| 1078 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 1079 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus.calls. length).to Equal(1); | |
| 1080 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus).toHav eBeenCalle dWith(OPDs yncStartJo bsValue[0] .metaStamp , '9E7A', jasmine.an y(Function )); | |
| 1081 | }); | |
| 1082 | }) ; | |
| 1083 | ||
| 1084 | it ('No metaS tamp', fun ction() { | |
| 1085 | var OPDs yncStartJo bNoStamp = { | |
| 1086 | coll ection: 'O PDsyncStar t', | |
| 1087 | syst emId: '9E7 A' | |
| 1088 | }; | |
| 1089 | var fini shed = fal se; | |
| 1090 | var actu alError; | |
| 1091 | var actu alResponse ; | |
| 1092 | runs(fun ction() { | |
| 1093 | proc essor._pro cessOPDSyn cStartJob( OPDsyncSta rtJobNoSta mp, functi on(error, response) { | |
| 1094 | actualErro r = error; | |
| 1095 | actualResp onse = res ponse; | |
| 1096 | finished = true; | |
| 1097 | }); | |
| 1098 | }); | |
| 1099 | ||
| 1100 | waitsFor (function( ) { | |
| 1101 | retu rn finishe d; | |
| 1102 | }, 'Call to _proce ssOPDSyncS tartJob fa iled to re turn in ti me.', 500) ; | |
| 1103 | ||
| 1104 | runs(fun ction() { | |
| 1105 | expe ct(actualE rror).toBe Null(); | |
| 1106 | expe ct(actualR esponse).t oBe('Faile dNoMetaSta mp'); | |
| 1107 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus.calls. length).to Equal(0); | |
| 1108 | }); | |
| 1109 | }) ; | |
| 1110 | }); | |
| 1111 | ||
| 1112 | descri be('_store MetaStamp' , function () { | |
| 1113 | it ('Happy Pa th', funct ion() { | |
| 1114 | var expe ctedJdsRes ponse = { | |
| 1115 | stat usCode: 20 0 | |
| 1116 | }; | |
| 1117 | jdsClien tDummy._se tResponseD ata(null, expectedJd sResponse, undefined ); | |
| 1118 | ||
| 1119 | var fini shed = fal se; | |
| 1120 | var actu alError; | |
| 1121 | var actu alResponse ; | |
| 1122 | runs(fun ction() { | |
| 1123 | proc essor._sto reMetaStam p(dummyLog ger, syncS tartJobsVa lue[0].met aStamp, pa tientIdent ifierValue 1, functio n(error, r esponse) { | |
| 1124 | actualErro r = error; | |
| 1125 | actualResp onse = res ponse; | |
| 1126 | finished = true; | |
| 1127 | }); | |
| 1128 | }); | |
| 1129 | ||
| 1130 | waitsFor (function( ) { | |
| 1131 | retu rn finishe d; | |
| 1132 | }, 'Call to _store MetaStamp failed to return in time.', 50 0); | |
| 1133 | ||
| 1134 | runs(fun ction() { | |
| 1135 | expe ct(actualE rror).toBe Falsy(); | |
| 1136 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 1137 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(1); | |
| 1138 | expe ct(jdsClie ntDummy.sa veSyncStat us.calls.l ength).toE qual(1); | |
| 1139 | expe ct(jdsClie ntDummy.sa veSyncStat us).toHave BeenCalled With(syncS tartJobsVa lue[0].met aStamp, pa tientIdent ifierValue 1, jasmine .any(Funct ion)); | |
| 1140 | }); | |
| 1141 | }) ; | |
| 1142 | it ('Error Fr om JDS', f unction() { | |
| 1143 | jdsClien tDummy._se tResponseD ata('Error occurred. ', null, u ndefined); | |
| 1144 | ||
| 1145 | var fini shed = fal se; | |
| 1146 | var actu alError; | |
| 1147 | var actu alResponse ; | |
| 1148 | runs(fun ction() { | |
| 1149 | proc essor._sto reMetaStam p(dummyLog ger, syncS tartJobsVa lue[0].met aStamp, pa tientIdent ifierValue 1, functio n(error, r esponse) { | |
| 1150 | actualErro r = error; | |
| 1151 | actualResp onse = res ponse; | |
| 1152 | finished = true; | |
| 1153 | }); | |
| 1154 | }); | |
| 1155 | ||
| 1156 | waitsFor (function( ) { | |
| 1157 | retu rn finishe d; | |
| 1158 | }, 'Call to _store MetaStamp failed to return in time.', 50 0); | |
| 1159 | ||
| 1160 | runs(fun ction() { | |
| 1161 | expe ct(actualE rror).toBe Null(); | |
| 1162 | expe ct(actualR esponse).t oBe('Faile dJdsError' ); | |
| 1163 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(1); | |
| 1164 | expe ct(jdsClie ntDummy.sa veSyncStat us.calls.l ength).toE qual(1); | |
| 1165 | expe ct(jdsClie ntDummy.sa veSyncStat us).toHave BeenCalled With(syncS tartJobsVa lue[0].met aStamp, pa tientIdent ifierValue 1, jasmine .any(Funct ion)); | |
| 1166 | }); | |
| 1167 | }) ; | |
| 1168 | it ('No respo nse From J DS', funct ion() { | |
| 1169 | jdsClien tDummy._se tResponseD ata(null, null, unde fined); | |
| 1170 | ||
| 1171 | var fini shed = fal se; | |
| 1172 | var actu alError; | |
| 1173 | var actu alResponse ; | |
| 1174 | runs(fun ction() { | |
| 1175 | proc essor._sto reMetaStam p(dummyLog ger, syncS tartJobsVa lue[0].met aStamp, pa tientIdent ifierValue 1, functio n(error, r esponse) { | |
| 1176 | actualErro r = error; | |
| 1177 | actualResp onse = res ponse; | |
| 1178 | finished = true; | |
| 1179 | }); | |
| 1180 | }); | |
| 1181 | ||
| 1182 | waitsFor (function( ) { | |
| 1183 | retu rn finishe d; | |
| 1184 | }, 'Call to _store MetaStamp failed to return in time.', 50 0); | |
| 1185 | ||
| 1186 | runs(fun ction() { | |
| 1187 | expe ct(actualE rror).toBe Null(); | |
| 1188 | expe ct(actualR esponse).t oBe('Faile dJdsNoResp onse'); | |
| 1189 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(1); | |
| 1190 | expe ct(jdsClie ntDummy.sa veSyncStat us.calls.l ength).toE qual(1); | |
| 1191 | expe ct(jdsClie ntDummy.sa veSyncStat us).toHave BeenCalled With(syncS tartJobsVa lue[0].met aStamp, pa tientIdent ifierValue 1, jasmine .any(Funct ion)); | |
| 1192 | }); | |
| 1193 | }) ; | |
| 1194 | it ('Incorrec t status c ode respon se From JD S', functi on() { | |
| 1195 | var expe ctedJdsRes ponse = { | |
| 1196 | stat usCode: 40 4 | |
| 1197 | }; | |
| 1198 | jdsClien tDummy._se tResponseD ata(null, expectedJd sResponse, undefined ); | |
| 1199 | ||
| 1200 | var fini shed = fal se; | |
| 1201 | var actu alError; | |
| 1202 | var actu alResponse ; | |
| 1203 | runs(fun ction() { | |
| 1204 | proc essor._sto reMetaStam p(dummyLog ger, syncS tartJobsVa lue[0].met aStamp, pa tientIdent ifierValue 1, functio n(error, r esponse) { | |
| 1205 | actualErro r = error; | |
| 1206 | actualResp onse = res ponse; | |
| 1207 | finished = true; | |
| 1208 | }); | |
| 1209 | }); | |
| 1210 | ||
| 1211 | waitsFor (function( ) { | |
| 1212 | retu rn finishe d; | |
| 1213 | }, 'Call to _store MetaStamp failed to return in time.', 50 0); | |
| 1214 | ||
| 1215 | runs(fun ction() { | |
| 1216 | expe ct(actualE rror).toBe Null(); | |
| 1217 | expe ct(actualR esponse).t oBe('Faile dJdsWrongS tatusCode' ); | |
| 1218 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(1); | |
| 1219 | expe ct(jdsClie ntDummy.sa veSyncStat us.calls.l ength).toE qual(1); | |
| 1220 | expe ct(jdsClie ntDummy.sa veSyncStat us).toHave BeenCalled With(syncS tartJobsVa lue[0].met aStamp, pa tientIdent ifierValue 1, jasmine .any(Funct ion)); | |
| 1221 | }); | |
| 1222 | }) ; | |
| 1223 | }); | |
| 1224 | ||
| 1225 | //_sto reOperatio nalMetasta mp | |
| 1226 | ||
| 1227 | descri be('_store Operationa lMetastamp ', functio n() { | |
| 1228 | it ('Happy Pa th', funct ion() { | |
| 1229 | var expe ctedJdsRes ponse = { | |
| 1230 | stat usCode: 20 0 | |
| 1231 | }; | |
| 1232 | jdsClien tDummy._se tResponseD ata(null, expectedJd sResponse, undefined ); | |
| 1233 | ||
| 1234 | var fini shed = fal se; | |
| 1235 | var actu alError; | |
| 1236 | var actu alResponse ; | |
| 1237 | runs(fun ction() { | |
| 1238 | proc essor._sto reOperatio nalMetaSta mp(OPDsync StartJobsV alue[0].me taStamp, ' 9E7A', fun ction(erro r, respons e) { | |
| 1239 | actualErro r = error; | |
| 1240 | actualResp onse = res ponse; | |
| 1241 | finished = true; | |
| 1242 | }); | |
| 1243 | }); | |
| 1244 | ||
| 1245 | waitsFor (function( ) { | |
| 1246 | retu rn finishe d; | |
| 1247 | }, 'Call to _store Operationa lMetaStamp failed to return in time.', 5 00); | |
| 1248 | ||
| 1249 | runs(fun ction() { | |
| 1250 | expe ct(actualE rror).toBe Falsy(); | |
| 1251 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 1252 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus.calls. length).to Equal(1); | |
| 1253 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus).toHav eBeenCalle dWith(OPDs yncStartJo bsValue[0] .metaStamp , '9E7A', jasmine.an y(Function )); | |
| 1254 | }); | |
| 1255 | }) ; | |
| 1256 | it ('Error Fr om JDS', f unction() { | |
| 1257 | jdsClien tDummy._se tResponseD ata('Error occurred. ', null, u ndefined); | |
| 1258 | ||
| 1259 | var fini shed = fal se; | |
| 1260 | var actu alError; | |
| 1261 | var actu alResponse ; | |
| 1262 | runs(fun ction() { | |
| 1263 | proc essor._sto reOperatio nalMetaSta mp(OPDsync StartJobsV alue[0].me taStamp, ' 9E7A', fun ction(erro r, respons e) { | |
| 1264 | actualErro r = error; | |
| 1265 | actualResp onse = res ponse; | |
| 1266 | finished = true; | |
| 1267 | }); | |
| 1268 | }); | |
| 1269 | ||
| 1270 | waitsFor (function( ) { | |
| 1271 | retu rn finishe d; | |
| 1272 | }, 'Call to _store Operationa lMetaStamp failed to return in time.', 5 00); | |
| 1273 | ||
| 1274 | runs(fun ction() { | |
| 1275 | expe ct(actualE rror).toBe Null(); | |
| 1276 | expe ct(actualR esponse).t oBe('Faile dJdsError' ); | |
| 1277 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus.calls. length).to Equal(1); | |
| 1278 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus).toHav eBeenCalle dWith(OPDs yncStartJo bsValue[0] .metaStamp , '9E7A', jasmine.an y(Function )); | |
| 1279 | }); | |
| 1280 | }) ; | |
| 1281 | it ('No respo nse From J DS', funct ion() { | |
| 1282 | jdsClien tDummy._se tResponseD ata(null, null, unde fined); | |
| 1283 | ||
| 1284 | var fini shed = fal se; | |
| 1285 | var actu alError; | |
| 1286 | var actu alResponse ; | |
| 1287 | runs(fun ction() { | |
| 1288 | proc essor._sto reOperatio nalMetaSta mp(OPDsync StartJobsV alue[0].me taStamp, ' 9E7A', fun ction(erro r, respons e) { | |
| 1289 | actualErro r = error; | |
| 1290 | actualResp onse = res ponse; | |
| 1291 | finished = true; | |
| 1292 | }); | |
| 1293 | }); | |
| 1294 | ||
| 1295 | waitsFor (function( ) { | |
| 1296 | retu rn finishe d; | |
| 1297 | }, 'Call to _store MetaStamp failed to return in time.', 50 0); | |
| 1298 | ||
| 1299 | runs(fun ction() { | |
| 1300 | expe ct(actualE rror).toBe Null(); | |
| 1301 | expe ct(actualR esponse).t oBe('Faile dJdsNoResp onse'); | |
| 1302 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus.calls. length).to Equal(1); | |
| 1303 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus).toHav eBeenCalle dWith(OPDs yncStartJo bsValue[0] .metaStamp , '9E7A', jasmine.an y(Function )); | |
| 1304 | }); | |
| 1305 | }) ; | |
| 1306 | it ('Incorrec t status c ode respon se From JD S', functi on() { | |
| 1307 | var expe ctedJdsRes ponse = { | |
| 1308 | stat usCode: 40 4 | |
| 1309 | }; | |
| 1310 | jdsClien tDummy._se tResponseD ata(null, expectedJd sResponse, undefined ); | |
| 1311 | ||
| 1312 | var fini shed = fal se; | |
| 1313 | var actu alError; | |
| 1314 | var actu alResponse ; | |
| 1315 | runs(fun ction() { | |
| 1316 | proc essor._sto reOperatio nalMetaSta mp(OPDsync StartJobsV alue[0].me taStamp, ' 9E7A', fun ction(erro r, respons e) { | |
| 1317 | actualErro r = error; | |
| 1318 | actualResp onse = res ponse; | |
| 1319 | finished = true; | |
| 1320 | }); | |
| 1321 | }); | |
| 1322 | ||
| 1323 | waitsFor (function( ) { | |
| 1324 | retu rn finishe d; | |
| 1325 | }, 'Call to _store MetaStamp failed to return in time.', 50 0); | |
| 1326 | ||
| 1327 | runs(fun ction() { | |
| 1328 | expe ct(actualE rror).toBe Null(); | |
| 1329 | expe ct(actualR esponse).t oBe('Faile dJdsWrongS tatusCode' ); | |
| 1330 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus.calls. length).to Equal(1); | |
| 1331 | expe ct(jdsClie ntDummy.sa veOperatio nalSyncSta tus).toHav eBeenCalle dWith(OPDs yncStartJo bsValue[0] .metaStamp , '9E7A', jasmine.an y(Function )); | |
| 1332 | }); | |
| 1333 | }) ; | |
| 1334 | }); | |
| 1335 | ||
| 1336 | descri be('_store CompletedJ ob', funct ion() { | |
| 1337 | it( 'Happy Pat h', functi on() { | |
| 1338 | dummyLog ger.debug( '********* ******* st arting _st oreComplet edJob:Happ y Path *** ********** ********** ****'); | |
| 1339 | var expe ctedJdsRes ponses = [ { | |
| 1340 | stat usCode: 20 0 | |
| 1341 | }, { | |
| 1342 | stat usCode: 20 0 | |
| 1343 | }]; | |
| 1344 | ||
| 1345 | var expe ctedJdsRes ults = [{ | |
| 1346 | jpid : jpidValu e | |
| 1347 | }, undef ined]; | |
| 1348 | jdsClien tDummy._se tResponseD ata([null, null], ex pectedJdsR esponses, expectedJd sResults); | |
| 1349 | ||
| 1350 | var fini shed = fal se; | |
| 1351 | var actu alError; | |
| 1352 | var actu alResponse ; | |
| 1353 | runs(fun ction() { | |
| 1354 | proc essor._sto reComplete dJob(dummy Logger, ro otJobIdVal ue, jobIdV alue, 'all ergy', pat ientIdenti fierValue1 , function (error, re sponse) { | |
| 1355 | actualErro r = error; | |
| 1356 | actualResp onse = res ponse; | |
| 1357 | finished = true; | |
| 1358 | }); | |
| 1359 | }); | |
| 1360 | ||
| 1361 | waitsFor (function( ) { | |
| 1362 | retu rn finishe d; | |
| 1363 | }, 'Call to _store CompletedJ ob failed to return in time.', 500); | |
| 1364 | ||
| 1365 | runs(fun ction() { | |
| 1366 | expe ct(actualE rror).toBe Falsy(); | |
| 1367 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 1368 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(2); // Onc e within t he _storeC ompletedJo b and once within jo bStatusUpd ater for t he jds cli ent. | |
| 1369 | expe ct(environ ment.jobSt atusUpdate r.childIns tance.call s.length). toEqual(1) ; | |
| 1370 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid.calls. length).to Equal(1); | |
| 1371 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid).toHav eBeenCalle dWith(pati entIdentif ierValue1. value, jas mine.any(F unction)); | |
| 1372 | expe ct(jdsClie ntDummy.sa veJobState .calls.len gth).toEqu al(1); | |
| 1373 | expe ct(jdsClie ntDummy.sa veJobState ).toHaveBe enCalledWi th({ | |
| 1374 | type: 'vista-C87 7-data-all ergy-polle r', | |
| 1375 | patien tIdentifie r: patient Identifier Value1, | |
| 1376 | jpid: jpidValue, | |
| 1377 | rootJo bId: rootJ obIdValue, | |
| 1378 | jobId: jobIdValu e, | |
| 1379 | status : 'complet ed', | |
| 1380 | timest amp: jasmi ne.any(Str ing) | |
| 1381 | }, | |
| 1382 | jasmine.an y(Function )); | |
| 1383 | dumm yLogger.de bug('***** ********** * ending _ storeCompl etedJob:Ha ppy Path * ********** ********** ******'); | |
| 1384 | }); | |
| 1385 | }) ; | |
| 1386 | it ('Happy Pa th for Vis taHdr', fu nction() { | |
| 1387 | dummyLog ger.debug( '********* ******* st arting _st oreComplet edJob:Happ y Path for VistaHdr ********** ********** *******'); | |
| 1388 | var expe ctedJdsRes ponses = [ { | |
| 1389 | stat usCode: 20 0 | |
| 1390 | }, { | |
| 1391 | stat usCode: 20 0 | |
| 1392 | }]; | |
| 1393 | ||
| 1394 | var expe ctedJdsRes ults = [{ | |
| 1395 | jpid : jpidValu e | |
| 1396 | }, undef ined]; | |
| 1397 | jdsClien tDummy._se tResponseD ata([null, null], ex pectedJdsR esponses, expectedJd sResults); | |
| 1398 | ||
| 1399 | var fini shed = fal se; | |
| 1400 | var actu alError; | |
| 1401 | var actu alResponse ; | |
| 1402 | runs(fun ction() { | |
| 1403 | hdrp rocessor._ storeCompl etedJob(du mmyLogger, rootJobId Value, job IdValue, ' allergy', hdrPatient Identifier Value1, fu nction(err or, respon se) { | |
| 1404 | actualErro r = error; | |
| 1405 | actualResp onse = res ponse; | |
| 1406 | finished = true; | |
| 1407 | }); | |
| 1408 | }); | |
| 1409 | ||
| 1410 | waitsFor (function( ) { | |
| 1411 | retu rn finishe d; | |
| 1412 | }, 'Call to _store CompletedJ ob failed to return in time.', 500); | |
| 1413 | ||
| 1414 | runs(fun ction() { | |
| 1415 | expe ct(actualE rror).toBe Falsy(); | |
| 1416 | expe ct(actualR esponse).t oBeTruthy( ); | |
| 1417 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(2); // Onc e within t he _storeC ompletedJo b and once within jo bStatusUpd ater for t he jds cli ent. | |
| 1418 | expe ct(environ ment.jobSt atusUpdate r.childIns tance.call s.length). toEqual(1) ; | |
| 1419 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid.calls. length).to Equal(1); | |
| 1420 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid).toHav eBeenCalle dWith(hdrP atientIden tifierValu e1.value, jasmine.an y(Function )); | |
| 1421 | expe ct(jdsClie ntDummy.sa veJobState .calls.len gth).toEqu al(1); | |
| 1422 | expe ct(jdsClie ntDummy.sa veJobState ).toHaveBe enCalledWi th({ | |
| 1423 | type: 'vistahdr- 84F0-data- allergy-po ller', | |
| 1424 | patien tIdentifie r: hdrPati entIdentif ierValue1, | |
| 1425 | jpid: jpidValue, | |
| 1426 | rootJo bId: rootJ obIdValue, | |
| 1427 | jobId: jobIdValu e, | |
| 1428 | status : 'complet ed', | |
| 1429 | timest amp: jasmi ne.any(Str ing) | |
| 1430 | }, | |
| 1431 | jasmine.an y(Function )); | |
| 1432 | dumm yLogger.de bug('***** ********** * ending _ storeCompl etedJob:Ha ppy Path * ********** ********** ******'); | |
| 1433 | }); | |
| 1434 | }) ; | |
| 1435 | it ('Error Fr om JDS on first call .', functi on() { | |
| 1436 | jdsClien tDummy._se tResponseD ata(['Erro r occurred .'], [null ], [undefi ned]); | |
| 1437 | ||
| 1438 | var fini shed = fal se; | |
| 1439 | var actu alError; | |
| 1440 | var actu alResponse ; | |
| 1441 | runs(fun ction() { | |
| 1442 | proc essor._sto reComplete dJob(dummy Logger, ro otJobIdVal ue, jobIdV alue, 'all ergy', pat ientIdenti fierValue1 , function (error, re sponse) { | |
| 1443 | actualErro r = error; | |
| 1444 | actualResp onse = res ponse; | |
| 1445 | finished = true; | |
| 1446 | }); | |
| 1447 | }); | |
| 1448 | ||
| 1449 | waitsFor (function( ) { | |
| 1450 | retu rn finishe d; | |
| 1451 | }, 'Call to _store CompletedJ ob failed to return in time.', 500); | |
| 1452 | ||
| 1453 | runs(fun ction() { | |
| 1454 | expe ct(actualE rror).toBe Null(); | |
| 1455 | expe ct(actualR esponse).t oBe('Faile dJdsError' ); | |
| 1456 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(1); // Onc e within t he _storeC ompletedJo b we skip the one wi thin jobSt atusUpdate r for the jds client . | |
| 1457 | expe ct(environ ment.jobSt atusUpdate r.childIns tance.call s.length). toEqual(0) ; | |
| 1458 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid.calls. length).to Equal(1); | |
| 1459 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid).toHav eBeenCalle dWith(pati entIdentif ierValue1. value, jas mine.any(F unction)); | |
| 1460 | expe ct(jdsClie ntDummy.sa veJobState .calls.len gth).toEqu al(0); | |
| 1461 | }); | |
| 1462 | }) ; | |
| 1463 | it ('No respo nse From J DS on firs t call', f unction() { | |
| 1464 | jdsClien tDummy._se tResponseD ata([null] , [null], [undefined ]); | |
| 1465 | ||
| 1466 | var fini shed = fal se; | |
| 1467 | var actu alError; | |
| 1468 | var actu alResponse ; | |
| 1469 | runs(fun ction() { | |
| 1470 | proc essor._sto reComplete dJob(dummy Logger, ro otJobIdVal ue, jobIdV alue, 'all ergy', pat ientIdenti fierValue1 , function (error, re sponse) { | |
| 1471 | actualErro r = error; | |
| 1472 | actualResp onse = res ponse; | |
| 1473 | finished = true; | |
| 1474 | }); | |
| 1475 | }); | |
| 1476 | ||
| 1477 | waitsFor (function( ) { | |
| 1478 | retu rn finishe d; | |
| 1479 | }, 'Call to _store CompletedJ ob failed to return in time.', 500); | |
| 1480 | ||
| 1481 | runs(fun ction() { | |
| 1482 | expe ct(actualE rror).toBe Null(); | |
| 1483 | expe ct(actualR esponse).t oBe('Faile dJdsNoResp onse'); | |
| 1484 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(1); // Onc e within t he _storeC ompletedJo b we skip the one wi thin jobSt atusUpdate r for the jds client . | |
| 1485 | expe ct(environ ment.jobSt atusUpdate r.childIns tance.call s.length). toEqual(0) ; | |
| 1486 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid.calls. length).to Equal(1); | |
| 1487 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid).toHav eBeenCalle dWith(pati entIdentif ierValue1. value, jas mine.any(F unction)); | |
| 1488 | expe ct(jdsClie ntDummy.sa veJobState .calls.len gth).toEqu al(0); | |
| 1489 | }); | |
| 1490 | }) ; | |
| 1491 | it ('Incorrec t status c ode respon se From JD S on first call', fu nction() { | |
| 1492 | var expe ctedJdsRes ponse = { | |
| 1493 | stat usCode: 40 4 | |
| 1494 | }; | |
| 1495 | jdsClien tDummy._se tResponseD ata([null] , [expecte dJdsRespon se], [unde fined]); | |
| 1496 | ||
| 1497 | var fini shed = fal se; | |
| 1498 | var actu alError; | |
| 1499 | var actu alResponse ; | |
| 1500 | runs(fun ction() { | |
| 1501 | proc essor._sto reComplete dJob(dummy Logger, ro otJobIdVal ue, jobIdV alue, 'all ergy', pat ientIdenti fierValue1 , function (error, re sponse) { | |
| 1502 | actualErro r = error; | |
| 1503 | actualResp onse = res ponse; | |
| 1504 | finished = true; | |
| 1505 | }); | |
| 1506 | }); | |
| 1507 | ||
| 1508 | waitsFor (function( ) { | |
| 1509 | retu rn finishe d; | |
| 1510 | }, 'Call to _store CompletedJ ob failed to return in time.', 500); | |
| 1511 | ||
| 1512 | runs(fun ction() { | |
| 1513 | expe ct(actualE rror).toBe Null(); | |
| 1514 | expe ct(actualR esponse).t oBe('Faile dJdsWrongS tatusCode' ); | |
| 1515 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(1); // Onc e within t he _storeC ompletedJo b we skip the one wi thin jobSt atusUpdate r for the jds client . | |
| 1516 | expe ct(environ ment.jobSt atusUpdate r.childIns tance.call s.length). toEqual(0) ; | |
| 1517 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid.calls. length).to Equal(1); | |
| 1518 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid).toHav eBeenCalle dWith(pati entIdentif ierValue1. value, jas mine.any(F unction)); | |
| 1519 | expe ct(jdsClie ntDummy.sa veJobState .calls.len gth).toEqu al(0); | |
| 1520 | }); | |
| 1521 | }) ; | |
| 1522 | it ('Error fr om JDS on second cal l (when st oring job) ', functio n() { | |
| 1523 | var expe ctedJdsRes ponses = [ { | |
| 1524 | stat usCode: 20 0 | |
| 1525 | }, { | |
| 1526 | stat usCode: 20 0 | |
| 1527 | }]; | |
| 1528 | ||
| 1529 | var expe ctedJdsRes ults = [{ | |
| 1530 | jpid : jpidValu e | |
| 1531 | }, undef ined]; | |
| 1532 | jdsClien tDummy._se tResponseD ata([null, 'JDSError Occurred'] , expected JdsRespons es, expect edJdsResul ts); | |
| 1533 | dummyLog ger.debug( 'SetRespon seData...' ); | |
| 1534 | ||
| 1535 | var fini shed = fal se; | |
| 1536 | var actu alError; | |
| 1537 | var actu alResponse ; | |
| 1538 | runs(fun ction() { | |
| 1539 | dumm yLogger.de bug('calli ng _storeC ompletedJo b...'); | |
| 1540 | proc essor._sto reComplete dJob(dummy Logger, ro otJobIdVal ue, jobIdV alue, 'all ergy', pat ientIdenti fierValue1 , function (error, re sponse) { | |
| 1541 | actualErro r = error; | |
| 1542 | actualResp onse = res ponse; | |
| 1543 | finished = true; | |
| 1544 | }); | |
| 1545 | }); | |
| 1546 | ||
| 1547 | waitsFor (function( ) { | |
| 1548 | retu rn finishe d; | |
| 1549 | }, 'Call to _store CompletedJ ob failed to return in time.', 500); | |
| 1550 | ||
| 1551 | runs(fun ction() { | |
| 1552 | expe ct(actualE rror).toBe Falsy(); | |
| 1553 | expe ct(actualR esponse).t oBe('Faile dJdsError' ); | |
| 1554 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(2); // Onc e within t he _storeC ompletedJo b and once within jo bStatusUpd ater for t he jds cli ent. | |
| 1555 | expe ct(environ ment.jobSt atusUpdate r.childIns tance.call s.length). toEqual(1) ; | |
| 1556 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid.calls. length).to Equal(1); | |
| 1557 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid).toHav eBeenCalle dWith(pati entIdentif ierValue1. value, jas mine.any(F unction)); | |
| 1558 | expe ct(jdsClie ntDummy.sa veJobState .calls.len gth).toEqu al(1); | |
| 1559 | expe ct(jdsClie ntDummy.sa veJobState ).toHaveBe enCalledWi th({ | |
| 1560 | type: 'vista-C87 7-data-all ergy-polle r', | |
| 1561 | patien tIdentifie r: patient Identifier Value1, | |
| 1562 | jpid: jpidValue, | |
| 1563 | rootJo bId: rootJ obIdValue, | |
| 1564 | jobId: jobIdValu e, | |
| 1565 | status : 'complet ed', | |
| 1566 | timest amp: jasmi ne.any(Str ing) | |
| 1567 | }, | |
| 1568 | jasmine.an y(Function )); | |
| 1569 | }); | |
| 1570 | }) ; | |
| 1571 | it ('Error fr om JDS on second cal l (when st oring job) for Vista Hdr', func tion() { | |
| 1572 | var expe ctedJdsRes ponses = [ { | |
| 1573 | stat usCode: 20 0 | |
| 1574 | }, { | |
| 1575 | stat usCode: 20 0 | |
| 1576 | }]; | |
| 1577 | ||
| 1578 | var expe ctedJdsRes ults = [{ | |
| 1579 | jpid : jpidValu e | |
| 1580 | }, undef ined]; | |
| 1581 | jdsClien tDummy._se tResponseD ata([null, 'JDSError Occurred'] , expected JdsRespons es, expect edJdsResul ts); | |
| 1582 | dummyLog ger.debug( 'SetRespon seData...' ); | |
| 1583 | ||
| 1584 | var fini shed = fal se; | |
| 1585 | var actu alError; | |
| 1586 | var actu alResponse ; | |
| 1587 | runs(fun ction() { | |
| 1588 | dumm yLogger.de bug('calli ng _storeC ompletedJo b...'); | |
| 1589 | hdrp rocessor._ storeCompl etedJob(du mmyLogger, rootJobId Value, job IdValue, ' allergy', hdrPatient Identifier Value1, fu nction(err or, respon se) { | |
| 1590 | actualErro r = error; | |
| 1591 | actualResp onse = res ponse; | |
| 1592 | finished = true; | |
| 1593 | }); | |
| 1594 | }); | |
| 1595 | ||
| 1596 | waitsFor (function( ) { | |
| 1597 | retu rn finishe d; | |
| 1598 | }, 'Call to _store CompletedJ ob failed to return in time.', 500); | |
| 1599 | ||
| 1600 | runs(fun ction() { | |
| 1601 | expe ct(actualE rror).toBe Falsy(); | |
| 1602 | expe ct(actualR esponse).t oBe('Faile dJdsError' ); | |
| 1603 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(2); // Onc e within t he _storeC ompletedJo b and once within jo bStatusUpd ater for t he jds cli ent. | |
| 1604 | expe ct(environ ment.jobSt atusUpdate r.childIns tance.call s.length). toEqual(1) ; | |
| 1605 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid.calls. length).to Equal(1); | |
| 1606 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid).toHav eBeenCalle dWith(hdrP atientIden tifierValu e1.value, jasmine.an y(Function )); | |
| 1607 | expe ct(jdsClie ntDummy.sa veJobState .calls.len gth).toEqu al(1); | |
| 1608 | expe ct(jdsClie ntDummy.sa veJobState ).toHaveBe enCalledWi th({ | |
| 1609 | type: 'vistahdr- 84F0-data- allergy-po ller', | |
| 1610 | patien tIdentifie r: hdrPati entIdentif ierValue1, | |
| 1611 | jpid: jpidValue, | |
| 1612 | rootJo bId: rootJ obIdValue, | |
| 1613 | jobId: jobIdValu e, | |
| 1614 | status : 'complet ed', | |
| 1615 | timest amp: jasmi ne.any(Str ing) | |
| 1616 | }, | |
| 1617 | jasmine.an y(Function )); | |
| 1618 | }); | |
| 1619 | }) ; | |
| 1620 | it ('JDS erro r no respo nse on sec ond call ( when stori ng job)', function() { | |
| 1621 | var expe ctedJdsRes ponses = [ { | |
| 1622 | stat usCode: 20 0 | |
| 1623 | }, undef ined]; | |
| 1624 | ||
| 1625 | var expe ctedJdsRes ults = [{ | |
| 1626 | jpid : jpidValu e | |
| 1627 | }, undef ined]; | |
| 1628 | jdsClien tDummy._se tResponseD ata([null, null], ex pectedJdsR esponses, expectedJd sResults); | |
| 1629 | dummyLog ger.debug( 'SetRespon seData...' ); | |
| 1630 | ||
| 1631 | var fini shed = fal se; | |
| 1632 | var actu alError; | |
| 1633 | var actu alResponse ; | |
| 1634 | runs(fun ction() { | |
| 1635 | dumm yLogger.de bug('calli ng _storeC ompletedJo b...'); | |
| 1636 | proc essor._sto reComplete dJob(dummy Logger, ro otJobIdVal ue, jobIdV alue, 'all ergy', pat ientIdenti fierValue1 , function (error, re sponse) { | |
| 1637 | actualErro r = error; | |
| 1638 | actualResp onse = res ponse; | |
| 1639 | finished = true; | |
| 1640 | }); | |
| 1641 | }); | |
| 1642 | ||
| 1643 | waitsFor (function( ) { | |
| 1644 | retu rn finishe d; | |
| 1645 | }, 'Call to _store CompletedJ ob failed to return in time.', 500); | |
| 1646 | ||
| 1647 | runs(fun ction() { | |
| 1648 | expe ct(actualE rror).toBe Falsy(); | |
| 1649 | expe ct(actualR esponse).t oBe('Faile dJdsNoResp onse'); | |
| 1650 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(2); // Onc e within t he _storeC ompletedJo b and once within jo bStatusUpd ater for t he jds cli ent. | |
| 1651 | expe ct(environ ment.jobSt atusUpdate r.childIns tance.call s.length). toEqual(1) ; | |
| 1652 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid.calls. length).to Equal(1); | |
| 1653 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid).toHav eBeenCalle dWith(pati entIdentif ierValue1. value, jas mine.any(F unction)); | |
| 1654 | expe ct(jdsClie ntDummy.sa veJobState .calls.len gth).toEqu al(1); | |
| 1655 | expe ct(jdsClie ntDummy.sa veJobState ).toHaveBe enCalledWi th({ | |
| 1656 | type: 'vista-C87 7-data-all ergy-polle r', | |
| 1657 | patien tIdentifie r: patient Identifier Value1, | |
| 1658 | jpid: jpidValue, | |
| 1659 | rootJo bId: rootJ obIdValue, | |
| 1660 | jobId: jobIdValu e, | |
| 1661 | status : 'complet ed', | |
| 1662 | timest amp: jasmi ne.any(Str ing) | |
| 1663 | }, | |
| 1664 | jasmine.an y(Function )); | |
| 1665 | }); | |
| 1666 | }) ; | |
| 1667 | it ('JDS erro r incorrec t status c ode on sec ond call ( when stori ng job)', function() { | |
| 1668 | var expe ctedJdsRes ponses = [ { | |
| 1669 | stat usCode: 20 0 | |
| 1670 | }, { | |
| 1671 | stat usCode: 40 4 | |
| 1672 | }]; | |
| 1673 | ||
| 1674 | var expe ctedJdsRes ults = [{ | |
| 1675 | jpid : jpidValu e | |
| 1676 | }, undef ined]; | |
| 1677 | jdsClien tDummy._se tResponseD ata([null, null], ex pectedJdsR esponses, expectedJd sResults); | |
| 1678 | dummyLog ger.debug( 'SetRespon seData...' ); | |
| 1679 | ||
| 1680 | var fini shed = fal se; | |
| 1681 | var actu alError; | |
| 1682 | var actu alResponse ; | |
| 1683 | runs(fun ction() { | |
| 1684 | dumm yLogger.de bug('calli ng _storeC ompletedJo b...'); | |
| 1685 | proc essor._sto reComplete dJob(dummy Logger, ro otJobIdVal ue, jobIdV alue, 'all ergy', pat ientIdenti fierValue1 , function (error, re sponse) { | |
| 1686 | actualErro r = error; | |
| 1687 | actualResp onse = res ponse; | |
| 1688 | finished = true; | |
| 1689 | }); | |
| 1690 | }); | |
| 1691 | ||
| 1692 | waitsFor (function( ) { | |
| 1693 | retu rn finishe d; | |
| 1694 | }, 'Call to _store CompletedJ ob failed to return in time.', 500); | |
| 1695 | ||
| 1696 | runs(fun ction() { | |
| 1697 | expe ct(actualE rror).toBe Falsy(); | |
| 1698 | expe ct(actualR esponse).t oBe('Faile dJdsWrongS tatusCode' ); | |
| 1699 | expe ct(jdsClie ntDummy.ch ildInstanc e.calls.le ngth).toEq ual(2); // Onc e within t he _storeC ompletedJo b and once within jo bStatusUpd ater for t he jds cli ent. | |
| 1700 | expe ct(environ ment.jobSt atusUpdate r.childIns tance.call s.length). toEqual(1) ; | |
| 1701 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid.calls. length).to Equal(1); | |
| 1702 | expe ct(jdsClie ntDummy.ge tPatientId entifierBy Pid).toHav eBeenCalle dWith(pati entIdentif ierValue1. value, jas mine.any(F unction)); | |
| 1703 | expe ct(jdsClie ntDummy.sa veJobState .calls.len gth).toEqu al(1); | |
| 1704 | expe ct(jdsClie ntDummy.sa veJobState ).toHaveBe enCalledWi th({ | |
| 1705 | type: 'vista-C87 7-data-all ergy-polle r', | |
| 1706 | patien tIdentifie r: patient Identifier Value1, | |
| 1707 | jpid: jpidValue, | |
| 1708 | rootJo bId: rootJ obIdValue, | |
| 1709 | jobId: jobIdValu e, | |
| 1710 | status : 'complet ed', | |
| 1711 | timest amp: jasmi ne.any(Str ing) | |
| 1712 | }, | |
| 1713 | jasmine.an y(Function )); | |
| 1714 | }); | |
| 1715 | }) ; | |
| 1716 | ||
| 1717 | }); | |
| 1718 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.