Produced by Araxis Merge on 10/4/2017 8:04:35 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 | rdk.zip\rdk\product\production\rdk\src\resources\patient-photo | patient-photo-resource-spec.js | Mon Aug 21 12:51:00 2017 UTC |
| 2 | rdk.zip\rdk\product\production\rdk\src\resources\patient-photo | patient-photo-resource-spec.js | Tue Oct 3 18:17:49 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 17 | 568 |
| Changed | 16 | 58 |
| 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 | var rdk = require('. ./../core/ rdk'); | |
| 3 | var _ = re quire('lod ash'); | |
| 4 | var http = rdk.utils .http; | |
| 5 | var patien tPhotoReso urce = req uire('./pa tient-phot o-resource '); | |
| 6 | var bunyan = require ('bunyan') ; | |
| 7 | var data = require(' ./patient- photo-reso urce-data' ).data; | |
| 8 | ||
| 9 | describe(' Patient Ph oto Resour ce Test', function() { | |
| 10 | it('te sts that g etResource Config() i s setup co rrectly fo r getPatie ntPhoto', function() { | |
| 11 | va r resource s = patien tPhotoReso urce.getRe sourceConf ig(); | |
| 12 | ex pect(resou rces.lengt h).to.equa l(1); | |
| 13 | ex pect(resou rces[0].na me).to.equ al('patien tphoto-get PatientPho to'); | |
| 14 | ex pect(resou rces[0].pa th).to.equ al(''); | |
| 15 | }); | |
| 16 | ||
| 17 | it.ski p('tests t hat getPat ientPhoto returns a photo', fu nction() { | |
| 18 | va r statusOb ject = { | |
| 19 | send: fu nction(dat a) { | |
| 20 | retu rn data; | |
| 21 | } | |
| 22 | }; | |
| 23 | va r res = { | |
| 24 | status: function(s tatusCode) { | |
| 25 | this .statusCod e = status Code; | |
| 26 | retu rn this; | |
| 27 | }, | |
| 28 | send: fu nction(res ponseBody) { | |
| 29 | this .responseB ody = resp onseBody; | |
| 30 | expe ct(respons eBody).not .to.be.und efined(); | |
| 31 | }, | |
| 32 | type: fu nction() { | |
| 33 | retu rn this; | |
| 34 | }, | |
| 35 | set: fun ction() { | |
| 36 | retu rn this; | |
| 37 | } | |
| 38 | }; | |
| 39 | ||
| 40 | va r request = { | |
| 41 | //logger :bunyan.cr eateLogger ({name: 'p atient-pho to-resourc e-spec.js' }), | |
| 42 | logger: sinon.stub (bunyan.cr eateLogger ({ | |
| 43 | name : 'patient -photo-res ource-spec .js' | |
| 44 | })), | |
| 45 | audit: { | |
| 46 | data Domain: '' , | |
| 47 | logC ategory: ' ' | |
| 48 | }, | |
| 49 | intercep torResults : { | |
| 50 | pati entIdentif iers: { | |
| 51 | dfn: ' R E D A CTED ;8', | |
| 52 | vhic: 'VHI C; REDACTED ', | |
| 53 | site: ' R E D A CTED ' | |
| 54 | } | |
| 55 | }, | |
| 56 | app: { | |
| 57 | conf ig: { | |
| 58 | vhic: { | |
| 59 | baseUrl: ' http:// IP /vhicSend' , | |
| 60 | search : { | |
| 61 | pa th: 'cardi -id' | |
| 62 | } | |
| 63 | }, | |
| 64 | rpcConfig: { | |
| 65 | ||
| 66 | }, | |
| 67 | vistaSites : { | |
| 68 | ' R E D A CTED ': { | |
| 69 | accessCode : ' REDACT ', | |
| 70 | verifyCode : ' REDACTED ' | |
| 71 | } | |
| 72 | } | |
| 73 | } | |
| 74 | }, | |
| 75 | session: { | |
| 76 | user : { | |
| 77 | site: ' R E D A CTED ' | |
| 78 | } | |
| 79 | }, | |
| 80 | param: f unction() {} | |
| 81 | }; | |
| 82 | sinon.mock (request). expects('p aram').wit hArgs('pid ').twice() .returns(' R E D A CTED ;8'); | |
| 83 | si non.stub(h ttp, 'post ', functio n(vhicHttp Config, cb ) { | |
| 84 | var resp onse = { | |
| 85 | stat usCode: 20 0 | |
| 86 | }; | |
| 87 | return c b(null, re sponse, da ta); | |
| 88 | }) ; | |
| 89 | va r spy = si non.spy(re s, 'status ').withArg s(rdk.http status.ok) ; | |
| 90 | si non.spy(st atusObject , 'send'). withArgs(d ata); | |
| 91 | pa tientPhoto Resource.g etPatientP hoto(reque st, res); | |
| 92 | ex pect(patie ntPhotoRes ource.getP atientPhot o(request, res)).not .to.be(und efined); | |
| 93 | ex pect(spy.w ithArgs(rd k.httpstat us.ok).cal ledOnce); | |
| 94 | ex pect(spy.w ithArgs(da ta).called Once); | |
| 95 | }); | |
| 96 | ||
| 97 | it('te sts that g etPatientP hoto calls the rpc t o get the Vhic Id fr om local i nstance or mvi', fun ction() { | |
| 98 | va r statusOb ject = { | |
| 99 | send: fu nction(dat a) { | |
| 100 | retu rn data; | |
| 101 | } | |
| 102 | }; | |
| 103 | va r res = { | |
| 104 | status: function(s tatusCode) { | |
| 105 | this .statusCod e = status Code; | |
| 106 | retu rn this; | |
| 107 | }, | |
| 108 | send: fu nction(res ponseBody) { | |
| 109 | this .responseB ody = resp onseBody; | |
| 110 | expe ct(respons eBody).not .to.be.und efined(); | |
| 111 | }, | |
| 112 | type: fu nction() { | |
| 113 | retu rn this; | |
| 114 | }, | |
| 115 | set: fun ction() { | |
| 116 | retu rn this; | |
| 117 | } | |
| 118 | }; | |
| 119 | ||
| 120 | va r request = { | |
| 121 | logger: sinon.stub (bunyan.cr eateLogger ({ | |
| 122 | name : 'patient -photo-res ource-spec .js' | |
| 123 | })), | |
| 124 | audit: { | |
| 125 | data Domain: '' , | |
| 126 | logC ategory: ' ' | |
| 127 | }, | |
| 128 | intercep torResults : { | |
| 129 | pati entIdentif iers: { | |
| 130 | dfn: ' R E D A CTED ;8', | |
| 131 | vhic: 'VHI C; REDACTED ', | |
| 132 | site: ' R E D A CTED ' | |
| 133 | } | |
| 134 | }, | |
| 135 | app: { | |
| 136 | conf ig: { | |
| 137 | vhic: { | |
| 138 | baseUrl: ' http:// IP /vhicSend' , | |
| 139 | search : { | |
| 140 | pa th: 'cardi -id' | |
| 141 | } | |
| 142 | }, | |
| 143 | rpcConfig: { | |
| 144 | ||
| 145 | }, | |
| 146 | vistaSites : { | |
| 147 | ' R E D A CTED ': { | |
| 148 | accessCode : ' REDACT ', | |
| 149 | verifyCode : ' REDACTED ' | |
| 150 | } | |
| 151 | } | |
| 152 | } | |
| 153 | }, | |
| 154 | session: { | |
| 155 | user : { | |
| 156 | site: ' R E D A CTED ' | |
| 157 | } | |
| 158 | }, | |
| 159 | vistaCon fig: {}, | |
| 160 | param: f unction() {} | |
| 161 | }; | |
| 162 | sinon.mock (request). expects('p aram').wit hArgs('pid ').twice() .returns(' R E D A CTED ;8'); | |
| 163 | si non.stub(h ttp, 'post ', functio n(vhicHttp Config, cb ) { | |
| 164 | var resp onse = { | |
| 165 | stat usCode: 20 0 | |
| 166 | }; | |
| 167 | return c b(null, re sponse, da ta); | |
| 168 | }) ; | |
| 169 | si non.spy(re s, 'status ').withArg s(rdk.http status.ok) ; | |
| 170 | si non.spy(st atusObject , 'send'). withArgs(d ata); | |
| 171 | va r cb = fun ction() { | |
| 172 | expect(r pcCallBack Stub.callC ount).to.b e(1); | |
| 173 | }; | |
| 174 | va r rpcCallB ackStub = sinon.stub (patientPh otoResourc e, '_getPa tientPhoto CallRpcCal lback', fu nction(err or, result , request, res) { | |
| 175 | return c b(); | |
| 176 | }) ; | |
| 177 | pa tientPhoto Resource.g etPatientP hoto(reque st, res); | |
| 178 | rp cCallBackS tub.restor e(); | |
| 179 | }); | |
| 180 | ||
| 181 | it('te sts that g etPatientP hoto calls JDS to ge t the Vhic Id', func tion() { | |
| 182 | va r res = { | |
| 183 | status: function(s tatusCode) { | |
| 184 | this .statusCod e = status Code; | |
| 185 | retu rn this; | |
| 186 | }, | |
| 187 | send: fu nction(res ponseBody) { | |
| 188 | this .responseB ody = resp onseBody; | |
| 189 | expe ct(respons eBody).not .to.be.und efined(); | |
| 190 | }, | |
| 191 | type: fu nction() { | |
| 192 | retu rn this; | |
| 193 | }, | |
| 194 | set: fun ction() { | |
| 195 | retu rn this; | |
| 196 | } | |
| 197 | }; | |
| 198 | ||
| 199 | va r request = { | |
| 200 | logger: sinon.stub (bunyan.cr eateLogger ({ | |
| 201 | name : 'patient -photo-res ource-spec .js' | |
| 202 | })), | |
| 203 | audit: { | |
| 204 | data Domain: '' , | |
| 205 | logC ategory: ' ' | |
| 206 | }, | |
| 207 | intercep torResults : { | |
| 208 | pati entIdentif iers: { | |
| 209 | icn: ' R E D A CTED ;8', | |
| 210 | dfn: ' R E D A CTED ;8', | |
| 211 | vhic: 'VHI CID; REDACTED ', | |
| 212 | site: ' R E D A CTED ' | |
| 213 | } | |
| 214 | }, | |
| 215 | app: { | |
| 216 | conf ig: { | |
| 217 | vhic: { | |
| 218 | baseUrl: ' http:// IP /vhicSend' , | |
| 219 | search : { | |
| 220 | pa th: 'cardi -id' | |
| 221 | } | |
| 222 | }, | |
| 223 | rpcConfig: { | |
| 224 | ||
| 225 | }, | |
| 226 | vistaSites : { | |
| 227 | ' R E D A CTED ': { | |
| 228 | accessCode : ' REDACT ', | |
| 229 | verifyCode : ' REDACTED ' | |
| 230 | } | |
| 231 | } | |
| 232 | } | |
| 233 | }, | |
| 234 | session: { | |
| 235 | user : { | |
| 236 | site: ' R E D A CTED ' | |
| 237 | } | |
| 238 | }, | |
| 239 | vistaCon fig: {}, | |
| 240 | param: f unction() {} | |
| 241 | }; | |
| 242 | va r jdsRespo nse = { | |
| 243 | apiVersi on: '1.0', | |
| 244 | data: { | |
| 245 | upda ted: 20160 510153022, | |
| 246 | tota lItems: 1, | |
| 247 | curr entItemCou nt: 1, | |
| 248 | item s: [{ | |
| 249 | lastUpdate Time: '201 6050917192 9', | |
| 250 | localId: ' 08f1bc84-d 11f-46cc-8 0e1-6fb801 215e48', | |
| 251 | pid: 'JPID ;08f1bc84- d11f-46cc- 80e1-6fb80 1215e48', | |
| 252 | stampTime: '20160509 171929', | |
| 253 | uid: 'urn: va:vhic-id :JPID:08f1 bc84-d11f- 46cc-80e1- 6fb801215e 48:08f1bc8 4-d11f-46c c-80e1-6fb 801215e48' , | |
| 254 | vhicIds: [ { | |
| 255 | active : true, | |
| 256 | vhicId: ' REDACTED ' | |
| 257 | }] | |
| 258 | }] | |
| 259 | } | |
| 260 | }; | |
| 261 | sinon.mock (request). expects('p aram').wit hArgs('pid ').twice() .returns(' R E D A CTED ;8'); | |
| 262 | si non.stub(h ttp, 'get' , function (vhicHttpC onfig, cb) { | |
| 263 | var resp onse = { | |
| 264 | stat usCode: 20 0 | |
| 265 | }; | |
| 266 | return c b(null, re sponse, jd sResponse) ; | |
| 267 | }) ; | |
| 268 | si non.stub(h ttp, 'post ', functio n(vhicHttp Config, cb ) { | |
| 269 | var resp onse = { | |
| 270 | stat usCode: 20 0 | |
| 271 | }; | |
| 272 | return c b(null, re sponse, da ta); | |
| 273 | }) ; | |
| 274 | si non.spy(re s, 'status ').withArg s(rdk.http status.ok) ; | |
| 275 | va r cb = fun ction() { | |
| 276 | expect(r pcCallBack Stub.callC ount).to.b e(1); | |
| 277 | }; | |
| 278 | va r rpcCallB ackStub = sinon.stub (patientPh otoResourc e, '_getPa tientPhoto CallRpcCal lback', fu nction(err or, result , request, res) { | |
| 279 | return c b(); | |
| 280 | }) ; | |
| 281 | pa tientPhoto Resource.g etPatientP hoto(reque st, res); | |
| 282 | rp cCallBackS tub.restor e(); | |
| 283 | }); | |
| 284 | ||
| 285 | descri be('getVHI CHttpConfi g', functi on() { | |
| 286 | va r req; | |
| 287 | be foreEach(f unction() { | |
| 288 | req = {} ; | |
| 289 | _.set(re q, 'app.co nfig.vhic. search.pat h', '/vhic '); | |
| 290 | _.set(re q, 'app.co nfig.vhic. baseUrl', 'https://l ocalhost:8 896'); | |
| 291 | _.set(re q, 'app.co nfig.logge r', | |
| 292 | sino n.stub(bun yan.create Logger({ | |
| 293 | name: 'pat ient-photo -resource- spec.js' | |
| 294 | })) | |
| 295 | ); | |
| 296 | }) ; | |
| 297 | it ('creates a config o bject', fu nction() { | |
| 298 | var conf ig = patie ntPhotoRes ource._get VHICHttpCo nfig(req); | |
| 299 | expect(c onfig).to. eql({ | |
| 300 | sear ch: { | |
| 301 | path: '/vh ic' | |
| 302 | }, | |
| 303 | base Url: 'http s://localh ost:8896', | |
| 304 | url: '/vhic', | |
| 305 | logg er: req.lo gger, | |
| 306 | head ers: { | |
| 307 | 'Content-T ype': 'tex t/xml; cha rset=utf-8 ' | |
| 308 | } | |
| 309 | }); | |
| 310 | }) ; | |
| 311 | }); | |
| 312 | ||
| 313 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.