Produced by Araxis Merge on 10/3/2017 11:16:04 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\utils\resync | resync-jds-id-conflicts-spec.js | Tue Jan 10 16:20:50 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\utils\resync | resync-jds-id-conflicts-spec.js | Tue Oct 3 13:24:51 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 534 |
| Changed | 3 | 20 |
| 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 reques t = requir e('request '); | |
| 6 | var _ = re quire('und erscore'); | |
| 7 | var jdsCon flicts = r equire(glo bal.VX_UTI LS + 'resy nc/resync- jds-id-con flicts'); | |
| 8 | var log = require(gl obal.VX_DU MMIES + 'd ummy-logge r'); | |
| 9 | var JdsCli entDummy = require(g lobal.VX_D UMMIES + ' jds-client -dummy'); | |
| 10 | ||
| 11 | var config = { | |
| 12 | jds: { | |
| 13 | pr otocol: 'h ttp', | |
| 14 | host: ' IP ', | |
| 15 | port: PORT | |
| 16 | }, | |
| 17 | 'vista Sites': { | |
| 18 | '9 E7A': { | |
| 19 | 'name': 'panorama' , | |
| 20 | 'host': ' IP ', | |
| 21 | 'port': PORT , | |
| 22 | 'accessCod e': ' REDACT ', | |
| 23 | 'verifyCod e': ' REDACTED ', | |
| 24 | 'localIP ': '127.0. 0.1', | |
| 25 | 'localAd dress': 'l ocalhost', | |
| 26 | 'connect Timeout': 3000, | |
| 27 | 'sendTim eout': 100 00 | |
| 28 | }, | |
| 29 | 'C 877': { | |
| 30 | 'name': 'kodak', | |
| 31 | 'host': ' IP ', | |
| 32 | 'port': PORT , | |
| 33 | 'accessCod e': ' REDACT ', | |
| 34 | 'verifyCod e': ' REDACTED ', | |
| 35 | 'localIP ': '127.0. 0.1', | |
| 36 | 'localAd dress': 'l ocalhost', | |
| 37 | 'connect Timeout': 3000, | |
| 38 | 'sendTim eout': 100 00 | |
| 39 | } | |
| 40 | } | |
| 41 | }; | |
| 42 | ||
| 43 | var enviro nment = { publisherR outer: { | |
| 44 | publis h: functio n(jobsToPu blish, han dlerCallba ck) { | |
| 45 | ha ndlerCallb ack(null, jobsToPubl ish); | |
| 46 | } | |
| 47 | }}; | |
| 48 | ||
| 49 | describe(' When getti ng conflic ting ids f rom the JD S error me ssage ', f unction() { | |
| 50 | it('an d there is not any e rror data then retur n an empty list.' , function() { | |
| 51 | va r conflict sFound = j dsConflict s._getConf lictingPat ientIds(lo g, {}); | |
| 52 | ex pect(confl ictsFound) .toEqual([ ]); | |
| 53 | ||
| 54 | co nflictsFou nd = jdsCo nflicts._g etConflict ingPatient Ids(log, { error:{}}) ; | |
| 55 | ex pect(confl ictsFound) .toEqual([ ]); | |
| 56 | ||
| 57 | co nflictsFou nd = jdsCo nflicts._g etConflict ingPatient Ids(log, { error:{err ors:[]}}); | |
| 58 | ex pect(confl ictsFound) .toEqual([ ]); | |
| 59 | }); | |
| 60 | ||
| 61 | it('an d there ar e not any conflict t ype errors then retu rn an empt y list.', function() { | |
| 62 | va r conflict sFound = j dsConflict s._getConf lictingPat ientIds(lo g, {error: {errors:[{ reason: 12 3}, {reaso n: 345}]}} ); | |
| 63 | ex pect(confl ictsFound) .toEqual([ ]); | |
| 64 | }); | |
| 65 | ||
| 66 | it('an d there is a conflic t error th en the id is returne d.', funct ion() { | |
| 67 | va r errorMes sage = {er ror:{error s:[ | |
| 68 | {"domain ": "allerg ies", | |
| 69 | "message ": "missin g node", | |
| 70 | reason: 123}, | |
| 71 | {"domain ": "Identi fier C877; 3 Associat ed with ac 242adc-b52 f-4435-985 7-d70104ad 799a", | |
| 72 | "message ": "JPID C ollision D etected", | |
| 73 | reason: 223}]}}; | |
| 74 | ||
| 75 | va r conflict sFound = j dsConflict s._getConf lictingPat ientIds(lo g, errorMe ssage); | |
| 76 | ex pect(confl ictsFound) .toEqual([ 'C877;3']) ; | |
| 77 | }); | |
| 78 | }); | |
| 79 | ||
| 80 | describe(' When getti ng patient identifie rs from JD S ', funct ion() { | |
| 81 | var en vironment, patientId , callback , called, calledErro r, data; | |
| 82 | ||
| 83 | before Each(funct ion() { | |
| 84 | pa tientId = '10110V004 877'; | |
| 85 | ||
| 86 | en vironment = {jds: ne w JdsClien tDummy(log , config)} ; | |
| 87 | ||
| 88 | ca llback = f unction(er ror, resul t) { | |
| 89 | called = true; | |
| 90 | calledEr ror = erro r; | |
| 91 | data = r esult; | |
| 92 | }; | |
| 93 | }); | |
| 94 | ||
| 95 | it('an d there is an error then retur n the erro r.' , func tion() { | |
| 96 | en vironment. jds._setRe sponseData (["Connect ion Error" ], [null], null); | |
| 97 | ||
| 98 | jd sConflicts ._getPatie ntIdentifi ersFromJds (log, envi ronment, p atientId, callback); | |
| 99 | ||
| 100 | wa itsFor(fun ction() {r eturn call ed;}, 'sho uld be cal led', 100) ; | |
| 101 | ||
| 102 | ru ns(functio n() { | |
| 103 | expect(c alledError ).not.toBe Falsy(); | |
| 104 | }) ; | |
| 105 | }); | |
| 106 | ||
| 107 | it('an d there is an error response t hen return the error .', functi on() { | |
| 108 | en vironment. jds._setRe sponseData ([null], [ {statusCod e: 500}], {error: 'e rror'}); | |
| 109 | ||
| 110 | jd sConflicts ._getPatie ntIdentifi ersFromJds (log, envi ronment, p atientId, callback); | |
| 111 | ||
| 112 | wa itsFor(fun ction() {r eturn call ed;}, 'sho uld be cal led', 100) ; | |
| 113 | ||
| 114 | ru ns(functio n() { | |
| 115 | expect(c alledError ).not.toBe Falsy(); | |
| 116 | }) ; | |
| 117 | }); | |
| 118 | ||
| 119 | it('an d there ar e no patie nt identif iers retur ned then r eturn an e mpty list. ', functio n() { | |
| 120 | en vironment. jds._setRe sponseData ([null], [ {statusCod e: 200}], {}); | |
| 121 | ||
| 122 | jd sConflicts ._getPatie ntIdentifi ersFromJds (log, envi ronment, p atientId, callback); | |
| 123 | ||
| 124 | wa itsFor(fun ction() {r eturn call ed;}, 'sho uld be cal led', 100) ; | |
| 125 | ||
| 126 | ru ns(functio n() { | |
| 127 | expect(c alledError ).toBeFals y(); | |
| 128 | expect(d ata).toEqu al([]); | |
| 129 | }) ; | |
| 130 | }); | |
| 131 | ||
| 132 | it('an d patient identifier s are retu rned then return the patient i dentifiers .', functi on() { | |
| 133 | va r jdsIds = ['C3433;4 ', '234234 V323']; | |
| 134 | en vironment. jds._setRe sponseData ([null], [ {statusCod e: 200}], {patientId entifiers: jdsIds}); | |
| 135 | ||
| 136 | jd sConflicts ._getPatie ntIdentifi ersFromJds (log, envi ronment, p atientId, callback); | |
| 137 | ||
| 138 | wa itsFor(fun ction() {r eturn call ed;}, 'sho uld be cal led', 100) ; | |
| 139 | ||
| 140 | ru ns(functio n() { | |
| 141 | expect(c alledError ).toBeFals y(); | |
| 142 | expect(d ata).toEqu al(jdsIds) ; | |
| 143 | }) ; | |
| 144 | }); | |
| 145 | }); | |
| 146 | ||
| 147 | describe(' When tryin g to find and add a syncable i d from jds ', functi on() { | |
| 148 | var sy ncIds; | |
| 149 | ||
| 150 | before Each(funct ion() { | |
| 151 | sy ncIds = [] ; | |
| 152 | }); | |
| 153 | ||
| 154 | it('an d job pati ent id is in the lis t of jds i ds then do NOT add a syncable id.' , fun ction() { | |
| 155 | va r jobIds = '9E7A;5'; | |
| 156 | va r jdsIds = ['9E7A;3' , '9E7A;5' ]; | |
| 157 | ||
| 158 | jd sConflicts ._addSyncI d(config, jobIds, jd sIds, sync Ids); | |
| 159 | ||
| 160 | ex pect(syncI ds).toEqua l([]); | |
| 161 | }); | |
| 162 | ||
| 163 | it('an d there ar e not any syncable i ds in jds then do NO T add a sy ncable id. ', functio n() { | |
| 164 | va r jobIds = '354A3;5' ; | |
| 165 | va r jdsIds = ['46545;3 4', '544;1 ']; | |
| 166 | ||
| 167 | jd sConflicts ._addSyncI d(config, jobIds, jd sIds, sync Ids); | |
| 168 | ||
| 169 | ex pect(syncI ds).toEqua l([]); | |
| 170 | }); | |
| 171 | ||
| 172 | it('an d there is a primary site id i n the jds ids then a dd that id to the sy ncable lis t of ids.' , function () { | |
| 173 | va r jobIds = '354A3;5' ; | |
| 174 | va r jdsIds = ['544;1', '345345V3 432', '9E7 A;34', 'DO D;34543']; | |
| 175 | ||
| 176 | jd sConflicts ._addSyncI d(config, jobIds, jd sIds, sync Ids); | |
| 177 | ||
| 178 | ex pect(syncI ds).toEqua l(['9E7A;3 4']); | |
| 179 | }); | |
| 180 | ||
| 181 | it('an d there is an icn id in the jd s ids then add that id to the syncable l ist of ids .', functi on() { | |
| 182 | va r jobIds = '354A3;5' ; | |
| 183 | va r jdsIds = ['544;1', '345345V3 432', 'DOD ;34543']; | |
| 184 | ||
| 185 | jd sConflicts ._addSyncI d(config, jobIds, jd sIds, sync Ids); | |
| 186 | ||
| 187 | ex pect(syncI ds).toEqua l(['345345 V3432']); | |
| 188 | }); | |
| 189 | ||
| 190 | it('an d there is a dod sit e id in th e jds ids then add t hat id to the syncab le list of ids.', fu nction() { | |
| 191 | va r jobIds = '354A3;5' ; | |
| 192 | va r jdsIds = ['544;1', 'DOD;3454 3']; | |
| 193 | ||
| 194 | jd sConflicts ._addSyncI d(config, jobIds, jd sIds, sync Ids); | |
| 195 | ||
| 196 | ex pect(syncI ds).toEqua l(['DOD;34 543']); | |
| 197 | }); | |
| 198 | }); | |
| 199 | ||
| 200 | describe(' When tryin g to resyn c a job ', function( ) { | |
| 201 | var en vironment, job, call back, call ed, called Error, dat a; | |
| 202 | ||
| 203 | before Each(funct ion() { | |
| 204 | jo b = {patie ntIdentifi er: {type: 'icn', va lue: '1011 0V004877'} }; | |
| 205 | ||
| 206 | en vironment = { publis herRouter: { | |
| 207 | publish: function( jobsToPubl ish, handl erCallback ) { | |
| 208 | hand lerCallbac k(null, jo bsToPublis h); | |
| 209 | } | |
| 210 | }} ; | |
| 211 | en vironment. jds = new JdsClientD ummy(log, config); | |
| 212 | ||
| 213 | sp yOn(enviro nment.publ isherRoute r, 'publis h').andCal lThrough() ; | |
| 214 | ||
| 215 | ca llback = f unction(er ror, resul t) { | |
| 216 | called = true; | |
| 217 | calledEr ror = erro r; | |
| 218 | data = r esult; | |
| 219 | }; | |
| 220 | }); | |
| 221 | ||
| 222 | it('an d there is an error checking s ync status then resy nc the job .' , funct ion() { | |
| 223 | en vironment. jds._setRe sponseData (["Connect ion Error" ], [null], null); | |
| 224 | ||
| 225 | jd sConflicts ._resync(j ob, log, e nvironment , callback ); | |
| 226 | ||
| 227 | wa itsFor(fun ction() {r eturn call ed;}, 'sho uld be cal led', 100) ; | |
| 228 | ||
| 229 | ru ns(functio n() { | |
| 230 | expect(c alledError ).toBeFals y(); | |
| 231 | expect(e nvironment .publisher Router.pub lish).toHa veBeenCall ed(); | |
| 232 | expect(d ata).toEqu al('RESYNC ING'); | |
| 233 | }) ; | |
| 234 | }); | |
| 235 | ||
| 236 | it('an d there is an error response w hen checki ng the syn c status t hen resync the job.' , function () { | |
| 237 | en vironment. jds._setRe sponseData ([null], [ {statusCod e: 500}], {error: 'e rror'}); | |
| 238 | ||
| 239 | jd sConflicts ._resync(j ob, log, e nvironment , callback ); | |
| 240 | ||
| 241 | wa itsFor(fun ction() {r eturn call ed;}, 'sho uld be cal led', 100) ; | |
| 242 | ||
| 243 | ru ns(functio n() { | |
| 244 | expect(c alledError ).toBeFals y(); | |
| 245 | expect(e nvironment .publisher Router.pub lish).toHa veBeenCall ed(); | |
| 246 | expect(d ata).toEqu al('RESYNC ING'); | |
| 247 | }) ; | |
| 248 | }); | |
| 249 | ||
| 250 | it('an d resync i s already created th en do NOT resync the job.', fu nction() { | |
| 251 | en vironment. jds._setRe sponseData ([null], [ {statusCod e: 200}], {"jobStatu s": [{type : 'resync- request'}] }); | |
| 252 | ||
| 253 | jd sConflicts ._resync(j ob, log, e nvironment , callback ); | |
| 254 | ||
| 255 | wa itsFor(fun ction() {r eturn call ed;}, 'sho uld be cal led', 100) ; | |
| 256 | ||
| 257 | ru ns(functio n() { | |
| 258 | expect(c alledError ).toBeFals y(); | |
| 259 | expect(e nvironment .publisher Router.pub lish).not. toHaveBeen Called(); | |
| 260 | expect(d ata).toEqu al('NA'); | |
| 261 | }) ; | |
| 262 | }); | |
| 263 | ||
| 264 | it('an d resync h as not sta rted then resync the job.', fu nction() { | |
| 265 | en vironment. jds._setRe sponseData ([null], [ {statusCod e: 200}], {"jobStatu s": []}); | |
| 266 | ||
| 267 | jd sConflicts ._resync(j ob, log, e nvironment , callback ); | |
| 268 | ||
| 269 | wa itsFor(fun ction() {r eturn call ed;}, 'sho uld be cal led', 100) ; | |
| 270 | ||
| 271 | ru ns(functio n() { | |
| 272 | expect(c alledError ).toBeFals y(); | |
| 273 | expect(e nvironment .publisher Router.pub lish).toHa veBeenCall ed(); | |
| 274 | expect(d ata).toEqu al('RESYNC ING'); | |
| 275 | }) ; | |
| 276 | }); | |
| 277 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.