80. EPMO Open Source Coordination Office Redaction File Detail Report

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.

80.1 Files compared

# Location File Last Modified
1 rdk.zip\rdk\product\production\rdk\src\resources locations-resource-spec.js Mon Aug 21 12:51:00 2017 UTC
2 rdk.zip\rdk\product\production\rdk\src\resources locations-resource-spec.js Tue Oct 3 18:25:24 2017 UTC

80.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 10 668
Changed 9 28
Inserted 0 0
Removed 0 0

80.3 Comparison options

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

80.4 Active regular expressions

No regular expressions were active.

80.5 Comparison detail

  1   'use stric t';
  2  
  3   var _ = re quire('lod ash');
  4   var rdk =  require('. ./core/rdk ');
  5   var locati onsResourc e = requir e('./locat ions-resou rce');
  6   var jdsFil terInterce ptor = req uire('../i nterceptor s/jds-filt er-interce ptor');
  7  
  8   var patien tSelect =  require('. /patient-s earch/hmp- patient-se lect');
  9  
  10   var logger  = {
  11       trace:  function( ) {},
  12       debug:  function( ) {},
  13       info:  function()  {},
  14       warn:  function()  {},
  15       error:  function( ) {},
  16       fatal:  function( ) {}
  17   };
  18  
  19  
  20   function c reateReqWi thParam(ma p) {
  21       map =  map || {};
  22       var re q = {
  23           pa ram: (func tion param (map, name , defaultV alue) {
  24                if (_.ha s(map, nam e)) {
  25                    retu rn map[nam e] !== nul l ? String (map[name] ) : null;
  26                }
  27  
  28                if (defa ultValue ! == undefin ed && defa ultValue ! == null) {
  29                    Stri ng(default Value);
  30                }
  31  
  32                return d efaultValu e;
  33           }) .bind(null , map),
  34           se ssion: {
  35                user: {
  36                      site: ' R E D A CTED '
  37                }
  38           },
  39           qu ery: map,
  40           in terceptorR esults: {
  41                jdsFilte r: {
  42                    filt er: []
  43                }
  44           },
  45           lo gger: logg er,
  46           ap p: {
  47                config:  {
  48                    jdsS erver: {
  49                         baseUrl: ' '
  50                    },
  51                    rpcC onfig: {}
  52                }
  53           }
  54       };
  55       var re s = {};
  56       var ne xt = (func tion() {}) ;
  57       jdsFil terInterce ptor(req,  res, next) ;
  58       return  req;
  59   }
  60  
  61  
  62   describe(' createReqW ithParam()  tester',  function()  {
  63       it('te st createR eqWithPara m', functi on() {
  64           va r req = cr eateReqWit hParam();
  65  
  66           ex pect(req.p aram('test ')).to.be. undefined( );
  67           ex pect(req.p aram('test ', 'defaul t')).to.eq ual('defau lt');
  68       });
  69  
  70       it('te st createR eqWithPara m', functi on() {
  71           va r req = cr eateReqWit hParam({
  72                name: 'v alue'
  73           }) ;
  74  
  75           ex pect(req.p aram('name ')).to.equ al('value' );
  76       });
  77  
  78       it('te st createR eqWithPara m', functi on() {
  79           va r req = cr eateReqWit hParam({
  80                name: 't est',
  81                start: 0 ,
  82                limit: 1 0,
  83                bogus: n ull
  84           }) ;
  85  
  86           ex pect(req.p aram('name ')).to.equ al('test') ;
  87           ex pect(req.p aram('star t')).to.eq ual('0');
  88           ex pect(req.p aram('limi t')).to.eq ual('10');
  89           ex pect(req.p aram('bogu s')).to.be .null();
  90           ex pect(req.p aram('unde fined')).t o.be.undef ined();
  91       });
  92   });
  93  
  94   describe(' locationsR esource te ster', fun ction() {
  95       it('te sts that h andleError () correct ly handles  and logs  an error',  function( ) {
  96           va r res = {
  97                status:  sinon.spy( function()  {
  98                    retu rn res;
  99                }),
  100                rdkSend:  sinon.spy ()
  101           };
  102           va r error =  {
  103                value: ' error stri ng'
  104           };
  105           va r logger =  {
  106                error: s inon.spy()
  107           };
  108  
  109           lo cationsRes ource._han dleError(l ogger, res , error, ' wards', 'f ilterValue ');
  110  
  111           ex pect(logge r.error.ca lled).to.b e.true();
  112  
  113           ex pect(res.s tatus.call edWith(rdk .httpstatu s.internal _server_er ror)).to.b e.true();
  114           ex pect(res.r dkSend.cal ledWith('T here was a n error pr ocessing y our reques t. The err or has bee n logged.' )).to.be.t rue();
  115       });
  116  
  117       it('te sts that g etResource Config() i s setup fo r clinics  properly',  function( ) {
  118           va r resource s = locati onsResourc e.getResou rceConfig( );
  119           ex pect(resou rces.lengt h).to.equa l(2);
  120  
  121           ex pect(resou rces[0].na me).to.equ al('locati ons-wards- search');
  122           ex pect(resou rces[0].pa th).to.equ al('wards/ patients') ;
  123           ex pect(resou rces[0].in terceptors ).to.eql({
  124                jdsFilte r: true,
  125                synchron ize: false
  126           }) ;
  127           ex pect(resou rces[0].su bsystems). not.to.be. undefined( );
  128       });
  129  
  130       it('te sts that g etResource Config() i s setup fo r clinics  properly',  function( ) {
  131           va r resource s = locati onsResourc e.getResou rceConfig( );
  132           ex pect(resou rces.lengt h).to.equa l(2);
  133  
  134           ex pect(resou rces[1].na me).to.equ al('locati ons-clinic s-search') ;
  135           ex pect(resou rces[1].pa th).to.equ al('clinic s/patients ');
  136           ex pect(resou rces[1].in terceptors ).to.eql({
  137                jdsFilte r: true,
  138                synchron ize: false
  139           }) ;
  140           ex pect(resou rces[1].su bsystems). not.to.be. undefined( );
  141       });
  142   });
  143  
  144   describe(' extractDfn sFromRpc',  function( ) {
  145       var ca llback;
  146       before Each(funct ion() {
  147           ca llback = s inon.spy() ;
  148       });
  149       it('sh ould handl e expected  server er rors', fun ction(done ) {
  150           lo cationsRes ource._ext ractDfnsFr omRpc(null , 'clinic' , '^Server  Error', f unction(er ror) {
  151                expect(e rror).to.b e.an.error ();
  152                expect(e rror.messa ge).to.equ al('Server  Error');
  153                done();
  154           }) ;
  155       });
  156       it('sh ould handl e unexpect ed server  errors', f unction()  {
  157           lo cationsRes ource._ext ractDfnsFr omRpc(null , 'clinic' , '^Unknow n Error',  callback);
  158           ex pect(callb ack.called With('Unkn own Error' )).to.be.t rue();
  159       });
  160       it('sh ould handl e no patie nts found' , function () {
  161           lo cationsRes ource._ext ractDfnsFr omRpc(null , 'clinic' , '^No pat ients foun d.\r\n', c allback);
  162           ex pect(callb ack.called With('No r esults fou nd.')).to. be.true();
  163       });
  164       it('sh ould handl e no appoi ntments',  function()  {
  165           lo cationsRes ource._ext ractDfnsFr omRpc(null , 'ward',  '^No appoi ntments.\r \n', callb ack);
  166           ex pect(callb ack.called With('No r esults fou nd.')).to. be.true();
  167       });
  168       it('sh ould retur n a list o f patients  with room /bed numbe rs when gi ven a pati ent for a  ward', fun ction() {
  169           va r rpcRespo nse = '100 708^ONE,IN PATIENT^72 2-^3130830 .1\r\n1007 10^TWO,INP ATIENT^722 -^3131002. 13\r\n1007 11^THREE,I NPATIENT^7 24-^313100 3.13\r\n10 0712^FOUR, INPATIENT^ 724-^31310 10.13\r\n1 00713^FIVE ,INPATIENT ^724-^3131 202.13\r\n ';
  170           va r expected Dfns = [{
  171                dfn: '10 0708',
  172                roomBed:  '722-'
  173           },  {
  174                dfn: '10 0710',
  175                roomBed:  '722-'
  176           },  {
  177                dfn: '10 0711',
  178                roomBed:  '724-'
  179           },  {
  180                dfn: '10 0712',
  181                roomBed:  '724-'
  182           },  {
  183                dfn: '10 0713',
  184                roomBed:  '724-'
  185           }] ;
  186           lo cationsRes ource._ext ractDfnsFr omRpc(null , 'ward',  rpcRespons e, callbac k);
  187           ex pect(callb ack.called With(null,  expectedD fns)).to.b e.true();
  188       });
  189       it('sh ould conso lidate dfn s for a wa rd', funct ion() {
  190           va r rpcRespo nse = '100 708^ONE,IN PATIENT^72 2-^3130830 .1\r\n1007 08^ONE,INP ATIENT^723 -^3130830. 1\r\n';
  191           va r expected Dfns = [{
  192                dfn: '10 0708',
  193                roomBed:  '722-'
  194           }] ;
  195           lo cationsRes ource._ext ractDfnsFr omRpc(null , 'ward',  rpcRespons e, callbac k);
  196           ex pect(callb ack.called With(null,  expectedD fns)).to.b e.true();
  197       });
  198       it('sh ould retur n a list o f patients  with appo intment ti mes when g iven a pat ient for a  clinic',  function()  {
  199           va r rpcRespo nse = '100 708^ONE,IN PATIENT^72 2-^3130830 .1\r\n1007 10^TWO,INP ATIENT^722 -^3131002. 13\r\n1007 11^THREE,I NPATIENT^7 24-^313100 3.13\r\n10 0712^FOUR, INPATIENT^ 724-^31310 10.13\r\n1 00713^FIVE ,INPATIENT ^724-^3131 202.13\r\n ';
  200           va r expected Dfns = [{
  201                dfn: '10 0708',
  202                appointm entTime: ' 2013083010 0000'
  203           },  {
  204                dfn: '10 0710',
  205                appointm entTime: ' 2013100213 0000'
  206           },  {
  207                dfn: '10 0711',
  208                appointm entTime: ' 2013100313 0000'
  209           },  {
  210                dfn: '10 0712',
  211                appointm entTime: ' 2013101013 0000'
  212           },  {
  213                dfn: '10 0713',
  214                appointm entTime: ' 2013120213 0000'
  215           }] ;
  216           lo cationsRes ource._ext ractDfnsFr omRpc(null , 'clinic' , rpcRespo nse, callb ack);
  217           ex pect(callb ack.called With(null,  expectedD fns)).to.b e.true();
  218       });
  219       it('sh ould not c onsolidate  dfns for  a clinic',  function( ) {
  220           va r rpcRespo nse = '100 708^ONE,IN PATIENT^72 2-^3130830 .1\r\n1007 08^ONE,INP ATIENT^723 -^3130830. 1\r\n';
  221           va r expected Dfns = [{
  222                dfn: '10 0708',
  223                appointm entTime: ' 2013083010 0000'
  224           },  {
  225                dfn: '10 0708',
  226                appointm entTime: ' 2013083010 0000'
  227           }] ;
  228           lo cationsRes ource._ext ractDfnsFr omRpc(null , 'clinic' , rpcRespo nse, callb ack);
  229           ex pect(callb ack.called With(null,  expectedD fns)).to.b e.true();
  230       });
  231   });
  232  
  233   describe(' selectPati entsFromDf nsInBatche s', functi on() {
  234       var re q;
  235  
  236       before Each(funct ion() {
  237           re q = create ReqWithPar am();
  238       });
  239  
  240       it('ca lls select PatientsFr omDfns', f unction()  {
  241           va r mockResp onses = [
  242                [{
  243                    loca lId: '4',
  244                    fami lyName: 'E IGHT',
  245                    give nName: 'IM AGEPATIENT ',
  246                    sens itive: tru e
  247                }], // M arking the se as 'sen sitive' so  it won't  try to che ck JDS for  sensitivi ty.
  248                [{
  249                    loca lId: '222' ,
  250                    fami lyName: 'E IGHT',
  251                    give nName: 'PA TIENT',
  252                    sens itive: tru e
  253                }],
  254                []
  255           ];
  256           va r jdsCalls  = 0;
  257  
  258           si non.stub(p atientSele ct, 'fetch ', functio n(req, par ams, site,  callback)  {
  259                ++jdsCal ls;
  260                callback (undefined , mockResp onses.pop( ));
  261           }) ;
  262  
  263           va r dfns = [ ];
  264           fo r (var i =  0; i < 3;  i++) {
  265                dfns.pus h({
  266                    dfn:  String(i)
  267                });
  268           }
  269           va r expected PatientIte ms = {
  270                data: {
  271                    item s: [{
  272                         localId: ' 222',
  273                         familyName : 'EIGHT',
  274                         givenName:  'PATIENT' ,
  275                         sensitive:  true
  276                    }, {
  277                         localId: ' 4',
  278                         familyName : 'EIGHT',
  279                         givenName:  'IMAGEPAT IENT',
  280                         sensitive:  true
  281                    }, ]
  282                }
  283           };
  284             locationsR esource._s electPatie ntsFromDfn sInBatches (req, 'cli nic', ' R E D A CTED ', dfns, f unction(er r, patient Items) {
  285                expect(e rr).to.be. falsy();
  286                jdsCalls .must.equa l(3);
  287                patientI tems.must. eql(expect edPatientI tems);
  288           }) ;
  289       });
  290   });
  291  
  292   describe(' RPC calls' , function () {
  293       var re q = {
  294           se ssion: {
  295                user: {
  296                    acce ssCode: 'd ummyAccess Code',
  297                    veri fyCode: 'd ummyVerify Code',
  298                    divi sion: '500 '
  299                }
  300           },
  301  
  302           ap p: {
  303                config:  {
  304                    rpcC onfig: {
  305                         context: ' ORQOR DETA IL',
  306                          siteHash:  ' R E D A CTED '
  307                    },
  308                    vist aSites: {
  309                          ' R E D A CTED ': {
  310                             divisi on: [{
  311                                 id : '500',
  312                                 na me: 'PANOR AMA'
  313                             }],
  314                               host: ' IP          ',
  315                               port:  PORT ,
  316                             produc tion: fals e,
  317                               accessCode : ' REDACT ',
  318                               verifyCode : ' REDACTED ',
  319                               localIP: ' IP        ',
  320                             localA ddress: 'l ocalhost'
  321                         },
  322                         'C877': {
  323                             divisi on: [{
  324                                 id : '500',
  325                                 na me: 'KODAK '
  326                             }],
  327                               host: ' IP          ',
  328                               port:  PORT ,
  329                             produc tion: fals e,
  330                               accessCode : ' REDACT ',
  331                               verifyCode : ' REDACTED '
  332                         }
  333                    }
  334                }
  335           },
  336           lo gger: logg er,
  337           _r pcSystemCl ients: {}
  338       };
  339  
  340       it('Te sts that c onfig retu rns correc t config',  function( ) {
  341             var config  = locatio nsResource ._getVista Config(req , ' R E D A CTED ');
  342  
  343           ex pect(confi g).not.to. be.null();
  344  
  345           // division i s simple v alue
  346           ex pect(confi g.division ).eql('500 ');
  347       });
  348   });