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 | vista-record-processor-handler-spec.js | Tue Jan 10 16:20:50 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\handlers\vista-record-processor | vista-record-processor-handler-spec.js | Tue Oct 3 13:21:34 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 556 |
| 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 _ = re quire('und erscore'); | |
| 6 | var handle = require (global.VX _HANDLERS + 'vista-r ecord-proc essor/vist a-record-p rocessor-h andler'); | |
| 7 | var errorU til = requ ire(global .VX_UTILS + 'error') ; | |
| 8 | var log = require(gl obal.VX_DU MMIES + 'd ummy-logge r'); | |
| 9 | var jobUti l = requir e(global.V X_UTILS + 'job-utils '); | |
| 10 | var Publis herRouterD ummy = req uire(globa l.VX_DUMMI ES + 'publ isherRoute rDummy'); | |
| 11 | var Publis herDummy = require(g lobal.VX_D UMMIES + ' publisherD ummy'); | |
| 12 | var PatIdC ompareUtil = require (global.VX _DUMMIES + 'patient- id-compara tor-dummy' ); | |
| 13 | var metric sDummyLogg er = requi re(global. VX_DUMMIES + 'dummy- logger'); | |
| 14 | var dummyL ogger = re quire(glob al.VX_DUMM IES + 'dum my-logger' ); | |
| 15 | ||
| 16 | // MAKE SU RE YOU COM MENT OUT T HE FOLLOWI NG BEFORE CHECKING I N | |
| 17 | //-------- ---------- ---------- ---------- ---------- ---------- -- | |
| 18 | // // var logConfig = require( './worker- config'); | |
| 19 | // var log Config = { | |
| 20 | // 'lo ggers': [{ | |
| 21 | // 'name': ' root', | |
| 22 | // 'streams' : [{ | |
| 23 | // 'stre am': proce ss.stdout, | |
| 24 | // 'leve l': 'debug ' | |
| 25 | // }] | |
| 26 | // }], | |
| 27 | // }; | |
| 28 | // var log Util = req uire(globa l.VX_UTILS + 'log'); | |
| 29 | // logUtil .initializ e(logConfi g.loggers) ; | |
| 30 | // var dum myLogger = logUtil.g et('VistaR ecordProce ssor-spec' , 'host'); | |
| 31 | // End of code to co mment out. | |
| 32 | ||
| 33 | var JobSta tusUpdater = require (global.VX _SUBSYSTEM S + 'jds/J obStatusUp dater'); | |
| 34 | var JdsCli entDummy = require(g lobal.VX_D UMMIES + ' jds-client -dummy'); | |
| 35 | ||
| 36 | ||
| 37 | var rootJo b = { | |
| 38 | ro otJobId: 1 | |
| 39 | }; | |
| 40 | ||
| 41 | var lastUp dateTimeVa lue = '315 0106-1624' ; | |
| 42 | var vistaI dValue = ' C877'; | |
| 43 | ||
| 44 | var syncSt artJobsVal ue = [{ | |
| 45 | co llection: 'syncStart ', | |
| 46 | pi d: vistaId Value + '; 1', | |
| 47 | me taStamp: { | |
| 48 | stam pTime: '20 1501141151 26', | |
| 49 | sour ceMetaStam p: { | |
| 50 | 'C877' : { | |
| 51 | pid: vis taIdValue + ';1', | |
| 52 | localId: '1', | |
| 53 | stampTim e: '201501 14115126', | |
| 54 | domainMe taStamp: { | |
| 55 | 'allergy': { | |
| 56 | do main: 'all ergy', | |
| 57 | st ampTime: ' 2015011411 5126', | |
| 58 | ev entMetaSta mp: { | |
| 59 | 'urn :va:allerg y:C877:1:7 51': { | |
| 60 | stampT ime: '2015 0114115126 ' | |
| 61 | }, | |
| 62 | 'urn :va:allerg y:C877:1:7 52': { | |
| 63 | stampT ime: '2015 0114115126 ' | |
| 64 | } | |
| 65 | } | |
| 66 | } | |
| 67 | } | |
| 68 | } | |
| 69 | } | |
| 70 | } | |
| 71 | }, { | |
| 72 | co llection: 'syncStart ', | |
| 73 | pi d: vistaId Value + '; 2', | |
| 74 | me taStamp: { | |
| 75 | stam pTime: '20 1501141151 26', | |
| 76 | sour ceMetaStam p: { | |
| 77 | 'C877' : { | |
| 78 | pid: vis taIdValue + ';2', | |
| 79 | localId: '1', | |
| 80 | stampTim e: '201501 14115126', | |
| 81 | domainMe taStamp: { | |
| 82 | 'allergy': { | |
| 83 | do main: 'all ergy', | |
| 84 | st ampTime: ' 2015011411 5126', | |
| 85 | ev entMetaSta mp: { | |
| 86 | 'urn :va:allerg y:C877:2:3 00': { | |
| 87 | stampT ime: '2015 0114115126 ' | |
| 88 | }, | |
| 89 | 'urn :va:allerg y:C877:2:3 01': { | |
| 90 | stampT ime: '2015 0114115126 ' | |
| 91 | } | |
| 92 | } | |
| 93 | } | |
| 94 | } | |
| 95 | } | |
| 96 | } | |
| 97 | } | |
| 98 | }]; | |
| 99 | ||
| 100 | var vistaD ataJobAlle rgyObjectW ithoutPid = { | |
| 101 | ui d: 'urn:va :allergy:9 E7A:1:2783 7' | |
| 102 | }; | |
| 103 | ||
| 104 | var vistaD ataJobsVal ue = [{ | |
| 105 | co llection: 'allergy', | |
| 106 | pi d: vistaId Value + '; 1', | |
| 107 | ob ject: vist aDataJobAl lergyObjec tWithoutPi d | |
| 108 | }, { | |
| 109 | co llection: 'pt-select ', | |
| 110 | pi d: vistaId Value + '; 2', | |
| 111 | ob ject: { | |
| 112 | pid: vistaIdVa lue + ';2' | |
| 113 | } | |
| 114 | }, { | |
| 115 | co llection: 'doc-ref', | |
| 116 | ob ject: { | |
| 117 | data : 'some op erational data' | |
| 118 | } | |
| 119 | }]; | |
| 120 | ||
| 121 | var dataVa lue = { | |
| 122 | la stUpdate: lastUpdate TimeValue, | |
| 123 | it ems: [] | |
| 124 | }; | |
| 125 | dataValue. items = sy ncStartJob sValue.con cat(vistaD ataJobsVal ue); | |
| 126 | ||
| 127 | ||
| 128 | function g etConfig() { | |
| 129 | re turn { | |
| 130 | jds: { | |
| 131 | protoc ol: 'http' , | |
| 132 | host: ' IP ', | |
| 133 | port: PORT | |
| 134 | }, | |
| 135 | 'hmp .batch.siz e': 1000, | |
| 136 | hdr: { | |
| 137 | hdrSit es: { | |
| 138 | '84F0': { | |
| 139 | stationNum ber: 578 | |
| 140 | } | |
| 141 | }, | |
| 142 | pubsub Config: { | |
| 143 | maxBatch Size: 500 | |
| 144 | } | |
| 145 | } | |
| 146 | }; | |
| 147 | } | |
| 148 | ||
| 149 | function g etEnv(conf ig) { | |
| 150 | va r jdsClien tDummy = n ew JdsClie ntDummy(du mmyLogger, config); | |
| 151 | va r publishe rRouterDum my = new P ublisherRo uterDummy( dummyLogge r, config, Publisher Dummy); | |
| 152 | va r environm ent = { | |
| 153 | jobS tatusUpdat er: {}, | |
| 154 | metr ics: metri csDummyLog ger, | |
| 155 | pati entIdCompa rator: Pat IdCompareU til.detect AndResync, | |
| 156 | publ isherRoute r: publish erRouterDu mmy, | |
| 157 | jds: jdsClient Dummy | |
| 158 | }; | |
| 159 | en vironment. jobStatusU pdater = n ew JobStat usUpdater( dummyLogge r, config, environme nt.jds); | |
| 160 | ||
| 161 | re turn envir onment; | |
| 162 | } | |
| 163 | ||
| 164 | ||
| 165 | ||
| 166 | describe(' vista-reco rd-process or-handler .js', func tion() { | |
| 167 | // var job; | |
| 168 | // var rootJ ob; | |
| 169 | // var confi g; | |
| 170 | // var envir onment; | |
| 171 | // var callb ack; | |
| 172 | // var patie ntIdentifi er; | |
| 173 | ||
| 174 | de scribe('ha ndle()', f unction() { | |
| 175 | it(' verify mis sing job i s rejected ', functio n() { | |
| 176 | var co nfig = get Config(); | |
| 177 | var en vironment = getEnv(c onfig); | |
| 178 | var ca lled = fal se; | |
| 179 | var ca lledError; | |
| 180 | var ca lledResult ; | |
| 181 | ||
| 182 | handle (log, conf ig, enviro nment, nul l, functio n(error, r esult) { | |
| 183 | calledEr ror = erro r; | |
| 184 | calledRe sult = res ult; | |
| 185 | called = true; | |
| 186 | }); | |
| 187 | ||
| 188 | waitsF or(functio n() { | |
| 189 | return c alled; | |
| 190 | }, 'sh ould be ca lled', 100 ); | |
| 191 | ||
| 192 | runs(f unction() { | |
| 193 | expect(e rrorUtil.i sFatal(cal ledError)) .toBe(true ); | |
| 194 | expect(_ .isObject( calledErro r)).toBe(t rue); | |
| 195 | if (_.is Object(cal ledError)) { | |
| 196 | expect(cal ledError.m essage).to Be('No job given to handle'); | |
| 197 | } | |
| 198 | }); | |
| 199 | }); | |
| 200 | it(' verify inv alid job t ype is rej ected', fu nction() { | |
| 201 | var co nfig = get Config(); | |
| 202 | var en vironment = getEnv(c onfig); | |
| 203 | var ca lled = fal se; | |
| 204 | var ca lledError; | |
| 205 | var ca lledResult ; | |
| 206 | ||
| 207 | var jo b = { | |
| 208 | type: jo bUtil.hdrS yncRequest Type() | |
| 209 | }; | |
| 210 | handle (log, conf ig, enviro nment, job , function (error, re sult) { | |
| 211 | calledEr ror = erro r; | |
| 212 | calledRe sult = res ult; | |
| 213 | called = true; | |
| 214 | }); | |
| 215 | ||
| 216 | waitsF or(functio n() { | |
| 217 | return c alled; | |
| 218 | }, 'sh ould be ca lled', 100 ); | |
| 219 | ||
| 220 | runs(f unction() { | |
| 221 | expect(e rrorUtil.i sFatal(cal ledError)) .toBe(true ); | |
| 222 | expect(_ .isObject( calledErro r)).toBe(t rue); | |
| 223 | if (_.is Object(cal ledError)) { | |
| 224 | expect(cal ledError.m essage).to Be('Incorr ect job ty pe'); | |
| 225 | } | |
| 226 | }); | |
| 227 | }); | |
| 228 | it(' verify inv alid job f ormat (no record) is rejected' , function () { | |
| 229 | var co nfig = get Config(); | |
| 230 | var en vironment = getEnv(c onfig); | |
| 231 | var ca lled = fal se; | |
| 232 | var ca lledError; | |
| 233 | var ca lledResult ; | |
| 234 | ||
| 235 | var jo b = jobUti l.createVi staRecordP rocessorRe quest(null , rootJob) ; | |
| 236 | handle (log, conf ig, enviro nment, job , function (error, re sult) { | |
| 237 | calledEr ror = erro r; | |
| 238 | calledRe sult = res ult; | |
| 239 | called = true; | |
| 240 | }); | |
| 241 | ||
| 242 | waitsF or(functio n() { | |
| 243 | return c alled; | |
| 244 | }, 'sh ould be ca lled', 100 ); | |
| 245 | ||
| 246 | runs(f unction() { | |
| 247 | expect(e rrorUtil.i sFatal(cal ledError)) .toBe(true ); | |
| 248 | expect(_ .isObject( calledErro r)).toBe(t rue); | |
| 249 | if (_.is Object(cal ledError)) { | |
| 250 | expect(cal ledError.m essage).to Be('Invali d job'); | |
| 251 | } | |
| 252 | }); | |
| 253 | }); | |
| 254 | it(' verify val id job pro cessed', f unction() { | |
| 255 | var co nfig = get Config(); | |
| 256 | var en vironment = getEnv(c onfig); | |
| 257 | var ca lled = fal se; | |
| 258 | var ca lledError; | |
| 259 | var ca lledResult ; | |
| 260 | ||
| 261 | var jo b = jobUti l.createVi staRecordP rocessorRe quest(data Value, roo tJob); | |
| 262 | handle (log, conf ig, enviro nment, job , function (error, re sult) { | |
| 263 | calledEr ror = erro r; | |
| 264 | calledRe sult = res ult; | |
| 265 | called = true; | |
| 266 | }); | |
| 267 | ||
| 268 | waitsF or(functio n() { | |
| 269 | return c alled; | |
| 270 | }, 'sh ould be ca lled', 100 ); | |
| 271 | ||
| 272 | runs(f unction() { | |
| 273 | expect(e rrorUtil.i sFatal(cal ledError)) .toBe(fals e); | |
| 274 | expect(c alledError ).toBeNull (); | |
| 275 | expect(c alledResul t).toBeNul l(); | |
| 276 | }); | |
| 277 | }); | |
| 278 | ||
| 279 | }) ; | |
| 280 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.