49. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/4/2017 8:04:34 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.

49.1 Files compared

# Location File Last Modified
1 rdk.zip\rdk\product\production\rdk\src\resources\cds-patient-list patient-list-resource-spec.js Fri Aug 25 15:36:55 2017 UTC
2 rdk.zip\rdk\product\production\rdk\src\resources\cds-patient-list patient-list-resource-spec.js Tue Oct 3 18:13:36 2017 UTC

49.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 996
Changed 1 2
Inserted 0 0
Removed 0 0

49.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

49.4 Active regular expressions

No regular expressions were active.

49.5 Comparison detail

  1   'use stric t';
  2  
  3   var patien tListResou rce = requ ire('./pat ient-list- resource') ;
  4   var criter ia = requi re('./crit eria');
  5   var defini tion = req uire('./de finition') ;
  6   var patien tlist = re quire('./p atient-lis t');
  7  
  8   var rdk =  require('. ./../core/ rdk');
  9   var MongoC lient = re quire('mon godb').Mon goClient;
  10  
  11   var cdsSpe cUtil = re quire('../ cds-spec-u til/cds-sp ec-util');
  12   var cdsSub system = r equire('.. /../subsys tems/cds/c ds-subsyst em');
  13   var mockRe qResUtil =  cdsSpecUt il.mockReq ResUtil;
  14   var appRef erence = c dsSpecUtil .createApp Reference;
  15  
  16   function c reateCrite riaJson(na me) {
  17       var te stJson = {
  18           'n ame': '',
  19           'a ccessor':  'vital:ite ms[]:quali fiedName',
  20           'd atatype':  'integer',
  21           'p iece': '2: /'
  22       };
  23       //maki ng these o ptional fo r required  parameter  testing.. .
  24       if (na me) {
  25           te stJson.nam e = name;
  26       }
  27       return  testJson;
  28   }
  29  
  30   function c reateDefin itionJson( name) {
  31       var te stJson = {
  32           'n ame': '',
  33           'd escription ': 'user d efined des cription o f this def inition te mplate',
  34           'e xpression' : '{and: [  {or: [\'A .A\',\'B.B \'], {\'A. A\'} ]}'
  35       };
  36       //maki ng these o ptional fo r required  parameter  testing.. .
  37       if (na me) {
  38           te stJson.nam e = name;
  39       }
  40       return  testJson;
  41   }
  42  
  43   function c reatePatie ntlistJson (name) {
  44       var te stJson = {
  45           'n ame': '',
  46           'd efinition' : {
  47                'name':  'def five' ,
  48                'descrip tion': '2n d user def ined descr iption of  this defin ition temp late',
  49                'express ion': '{eq : [ {or: [ \'A.A\',\' B.B\'], {}  ]}',
  50                'date':  '2015-03-1 0T12:54:56 .899Z',
  51                'scope':  'private' ,
  52                  'owner': ' R E D A CTED '
  53           }
  54       };
  55       //maki ng these o ptional fo r required  parameter  testing.. .
  56       if (na me) {
  57           te stJson.nam e = name;
  58       }
  59       return  testJson;
  60   }
  61  
  62   describe(' CDS Patien t List Res ource', fu nction() {
  63       var re sources =  patientLis tResource. getResourc eConfig(ap pReference ());
  64       var in terceptors  = {
  65           op erationalD ataCheck:  false,
  66           sy nchronize:  false
  67       };
  68  
  69       it('ha s 14 endpo ints confi gured', fu nction() {
  70           ex pect(resou rces.lengt h).to.equa l(14);
  71       });
  72  
  73       it('ha s correct  configurat ion for Cr iteria get  ', functi on() {
  74           va r r = reso urces[0];
  75           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-criter ia-get');
  76           ex pect(r.pat h).to.equa l('/criter ia');
  77           ex pect(r.get ).not.to.b e.undefine d();
  78           ex pect(r.int erceptors) .to.eql(in terceptors );
  79       });
  80       it('ha s correct  configurat ion for Cr iteria pos t ', funct ion() {
  81           va r r = reso urces[1];
  82           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-criter ia-post');
  83           ex pect(r.pat h).to.equa l('/criter ia');
  84           ex pect(r.pos t).not.to. be.undefin ed();
  85           ex pect(r.int erceptors) .to.eql(in terceptors );
  86       });
  87       it('ha s correct  configurat ion for Cr iteria del ete ', fun ction() {
  88           va r r = reso urces[2];
  89           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-criter ia-delete' );
  90           ex pect(r.pat h).to.equa l('/criter ia');
  91           ex pect(r.del ete).not.t o.be.undef ined();
  92           ex pect(r.int erceptors) .to.eql(in terceptors );
  93       });
  94  
  95       it('ha s correct  configurat ion for De finition g et ', func tion() {
  96           va r r = reso urces[3];
  97           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-defini tion-get') ;
  98           ex pect(r.pat h).to.equa l('/defini tion');
  99           ex pect(r.get ).not.to.b e.undefine d();
  100           ex pect(r.int erceptors) .to.eql(in terceptors );
  101       });
  102       it('ha s correct  configurat ion for De finition p ost ', fun ction() {
  103           va r r = reso urces[4];
  104           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-defini tion-post' );
  105           ex pect(r.pat h).to.equa l('/defini tion');
  106           ex pect(r.pos t).not.to. be.undefin ed();
  107           ex pect(r.int erceptors) .to.eql(in terceptors );
  108       });
  109       it('ha s correct  configurat ion for De finition d elete ', f unction()  {
  110           va r r = reso urces[5];
  111           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-defini tion-delet e');
  112           ex pect(r.pat h).to.equa l('/defini tion');
  113           ex pect(r.del ete).not.t o.be.undef ined();
  114           ex pect(r.int erceptors) .to.eql(in terceptors );
  115       });
  116  
  117       it('ha s correct  configurat ion for De finition c opy ', fun ction() {
  118           va r r = reso urces[6];
  119           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-defini tion-copy' );
  120           ex pect(r.pat h).to.equa l('/defini tion/copy' );
  121           ex pect(r.get ).to.be.un defined();
  122           ex pect(r.pos t).not.to. be.undefin ed();
  123           ex pect(r.del ete).to.be .undefined ();
  124           ex pect(r.int erceptors) .to.eql(in terceptors );
  125       });
  126  
  127       it('ha s correct  configurat ion for Pa tientlist  get ', fun ction() {
  128           va r r = reso urces[7];
  129           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-patien tlist-get' );
  130           ex pect(r.pat h).to.equa l('/list') ;
  131           ex pect(r.get ).not.to.b e.undefine d();
  132           ex pect(r.int erceptors) .to.eql(in terceptors );
  133       });
  134       it('ha s correct  configurat ion for Pa tientlist  post ', fu nction() {
  135           va r r = reso urces[8];
  136           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-patien tlist-post ');
  137           ex pect(r.pat h).to.equa l('/list') ;
  138           ex pect(r.pos t).not.to. be.undefin ed();
  139           ex pect(r.int erceptors) .to.eql(in terceptors );
  140       });
  141       it('ha s correct  configurat ion for Pa tientlist  delete ',  function()  {
  142           va r r = reso urces[9];
  143           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-patien tlist-dele te');
  144           ex pect(r.pat h).to.equa l('/list') ;
  145           ex pect(r.del ete).not.t o.be.undef ined();
  146           ex pect(r.int erceptors) .to.eql(in terceptors );
  147       });
  148  
  149       it('ha s correct  configurat ion for Pa tientlist  add ', fun ction() {
  150           va r r = reso urces[10];
  151           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-patien tlist-add' );
  152           ex pect(r.pat h).to.equa l('/list/p atients');
  153           ex pect(r.get ).to.be.un defined();
  154           ex pect(r.pos t).not.to. be.undefin ed();
  155           ex pect(r.int erceptors) .to.eql(in terceptors );
  156       });
  157       it('ha s correct  configurat ion for Pa tientlist  remove ',  function()  {
  158           va r r = reso urces[11];
  159           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-patien tlist-remo ve');
  160           ex pect(r.pat h).to.equa l('/list/p atients');
  161           ex pect(r.get ).to.be.un defined();
  162           ex pect(r.del ete).not.t o.be.undef ined();
  163           ex pect(r.int erceptors) .to.eql(in terceptors );
  164       });
  165       it('ha s correct  configurat ion for Pa tientlist  status ',  function()  {
  166           va r r = reso urces[12];
  167           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-patien tlist-stat us');
  168           ex pect(r.pat h).to.equa l('/list/s tatus');
  169           ex pect(r.get ).not.to.b e.undefine d();
  170           ex pect(r.put ).to.be.un defined();
  171           ex pect(r.pos t).to.be.u ndefined() ;
  172           ex pect(r.del ete).to.be .undefined ();
  173           ex pect(r.int erceptors) .to.eql(in terceptors );
  174       });
  175  
  176       it('ha s correct  configurat ion for Pa tientlist  copy ', fu nction() {
  177           va r r = reso urces[13];
  178           ex pect(r.nam e).to.equa l('cds-pat ient-list- cds-patien tlist-copy ');
  179           ex pect(r.pat h).to.equa l('/list/c opy');
  180           ex pect(r.get ).to.be.un defined();
  181           ex pect(r.pos t).not.to. be.undefin ed();
  182           ex pect(r.del ete).to.be .undefined ();
  183           ex pect(r.int erceptors) .to.eql(in terceptors );
  184       });
  185  
  186       var re s = mockRe qResUtil.r esponse;
  187       var mo ckData;
  188       var db ;
  189  
  190       before Each(funct ion() {
  191           si non.spy(re s, 'status ');
  192  
  193           mo ckData = {
  194                testJson : null,
  195                echo: nu ll
  196           };
  197  
  198           db  = cdsSpec Util.creat eMockDb({
  199                find: fu nction() {
  200                    retu rn {
  201                         toArray: f unction(ca llback) {
  202                             callba ck(null, [ ]);
  203                         }
  204                    };
  205                },
  206                findOne:  function( match, cal lback) {
  207                    call back(null,  mockData. echo);
  208                },
  209                insert:  function(t estJson, c allback) {
  210                    mock Data.testJ son = {
  211                         _id: 'mong odb1234567 8'
  212                    };
  213                    mock Data.echo  = [mockDat a.testJson ];
  214                    call back(null,  mockData. echo); //  can mock a  response  here...
  215                },
  216                ensureIn dex: funct ion() {
  217                    retu rn;
  218                },
  219                remove:  function()  {
  220                    retu rn;
  221                }
  222           }) ;
  223           si non.stub(c dsSubsyste m, 'getCDS DB').calls Fake(funct ion(logger , dbName,  init, call back) {
  224                callback (null, db) ;
  225           }) ;
  226       });
  227  
  228       // Cri teria test s
  229       descri be('Criter ia endpoin t HTTP res ponse code s', functi on() {
  230           it ('GET resp onds HTTP  Not Found' , function () {
  231  
  232                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  233                    call back(null,  db);
  234                });
  235  
  236                //GET w/ name, and  return a s tatus 404  (not found )
  237                criteria .getCriter ia(mockReq ResUtil.cr eateReques tWithParam (null, nul l), res);
  238                expect(r es.status. calledWith (rdk.https tatus.not_ found)).to .be.true() ;
  239           }) ;
  240  
  241           it ('POST res ponds HTTP  Bad Reque st when re quired par ameter mis sing', fun ction() {
  242  
  243                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  244                    call back(null,  db);
  245                });
  246  
  247                //POST w /o name, r equired, a nd returns  a 400 (ba d request)
  248                mockData .testJson  = createCr iteriaJson ();
  249                criteria .postCrite ria(mockRe qResUtil.c reateReque stWithPara m(null, mo ckData.tes tJson), re s);
  250                expect(r es.status. calledWith (rdk.https tatus.bad_ request)). to.be.true ();
  251           }) ;
  252  
  253           it ('POST res ponds HTTP  Conflict' , function () {
  254  
  255                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  256                    call back(null,  db);
  257                });
  258  
  259                //POST p rovide req uired name  - this sh ould creat e one, and  return a  status 201  (created)
  260                mockData .testJson  = createCr iteriaJson ('criteria 1');
  261                mockData .echo = mo ckData.tes tJson;
  262                criteria .postCrite ria(mockRe qResUtil.c reateReque stWithPara m(null, mo ckData.tes tJson), re s);
  263                expect(r es.status. calledWith (rdk.https tatus.conf lict)).to. be.true();
  264           }) ;
  265  
  266           it ('POST res ponds HTTP  Created',  function( ) {
  267  
  268                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  269                    call back(null,  db);
  270                });
  271  
  272                //POST p rovide req uired name  - this sh ould creat e one, and  return a  status 201  (created)
  273                mockData .testJson  = createCr iteriaJson ('criteria 1');
  274                mockData .echo = {} ;
  275                criteria .postCrite ria(mockRe qResUtil.c reateReque stWithPara m(null, mo ckData.tes tJson), re s);
  276                expect(r es.status. calledWith (rdk.https tatus.crea ted)).to.b e.true();
  277           }) ;
  278  
  279           it ('DELETE r esponds HT TP Bad Req uest when  required p arameter m issing', f unction()  {
  280  
  281                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  282                    call back(null,  db);
  283                });
  284  
  285                //POST w /o name, r equired, a nd returns  a 400 (ba d request)
  286                mockData .testJson  = createCr iteriaJson ();
  287                criteria .deleteCri teria(mock ReqResUtil .createReq uestWithPa ram(null,  mockData.t estJson),  res);
  288                expect(r es.status. calledWith (rdk.https tatus.bad_ request)). to.be.true ();
  289           }) ;
  290       });
  291  
  292       // Def inition te sts
  293       descri be('Defini tion endpo int HTTP r esponse co des', func tion() {
  294           it ('GET resp onds HTTP  Not Found' , function () {
  295  
  296                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  297                    call back(null,  db);
  298                });
  299  
  300                //GET w/ name, and  return a s tatus 404  (not found )
  301                definiti on.getDefi nition(moc kReqResUti l.createRe questWithP aram(null,  null), re s);
  302                expect(r es.status. calledWith (rdk.https tatus.not_ found)).to .be.true() ;
  303           }) ;
  304  
  305           it ('POST res ponds HTTP  Bad Reque st when re quired par ameter mis sing', fun ction() {
  306  
  307                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  308                    call back(null,  db);
  309                });
  310  
  311                //POST w /o name, r equired, a nd returns  a 400 (ba d request)
  312                mockData .testJson  = createDe finitionJs on();
  313                definiti on.postDef inition(mo ckReqResUt il.createR equestWith Param(null , mockData .testJson) , res);
  314                expect(r es.status. calledWith (rdk.https tatus.bad_ request)). to.be.true ();
  315           }) ;
  316  
  317           it ('POST res ponds HTTP  Conflict' , function () {
  318  
  319                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  320                    call back(null,  db);
  321                });
  322  
  323                //POST p rovide req uired name  - this sh ould creat e one, and  return a  status 201  (created)
  324                mockData .testJson  = createDe finitionJs on('defini tion1');
  325                mockData .echo = mo ckData.tes tJson;
  326                definiti on.postDef inition(mo ckReqResUt il.createR equestWith Param(null , mockData .testJson) , res);
  327                expect(r es.status. calledWith (rdk.https tatus.conf lict)).to. be.true();
  328           }) ;
  329  
  330           it ('POST res ponds HTTP  Created',  function( ) {
  331  
  332                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  333                    call back(null,  db);
  334                });
  335  
  336                //POST p rovide req uired name  - this sh ould creat e one, and  return a  status 201  (created)
  337                mockData .testJson  = createDe finitionJs on('defini tion1');
  338                mockData .echo = {} ;
  339                definiti on.postDef inition(mo ckReqResUt il.createR equestWith Param(null , mockData .testJson) , res);
  340                expect(r es.status. calledWith (rdk.https tatus.crea ted)).to.b e.true();
  341           }) ;
  342  
  343           it ('DELETE r esponds HT TP Bad Req uest when  required p arameter m issing', f unction()  {
  344  
  345                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  346                    call back(null,  db);
  347                });
  348  
  349                //POST w /o name, r equired, a nd returns  a 400 (ba d request)
  350                mockData .testJson  = createDe finitionJs on();
  351                definiti on.deleteD efinition( mockReqRes Util.creat eRequestWi thParam(nu ll, mockDa ta.testJso n), res);
  352                expect(r es.status. calledWith (rdk.https tatus.bad_ request)). to.be.true ();
  353           }) ;
  354  
  355           it ('COPY res ponds HTTP  Bad Reque st when re quired par ameter mis sing', fun ction() {
  356  
  357                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  358                    call back(null,  db);
  359                });
  360  
  361                //POST w /o name, r equired, a nd returns  a 400 (ba d request)
  362                mockData .testJson  = createDe finitionJs on();
  363                definiti on.copyDef inition(mo ckReqResUt il.createR equestWith Param(null , mockData .testJson) , res);
  364                expect(r es.status. calledWith (rdk.https tatus.bad_ request)). to.be.true ();
  365           }) ;
  366           it ('COPY res ponds HTTP  Not Found  when sour ce missing ', functio n() {
  367  
  368                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  369                    call back(null,  db);
  370                });
  371  
  372                //POST n o source,  returns a  404 (not f ound)
  373                mockData .echo = nu ll;
  374                definiti on.copyDef inition(mo ckReqResUt il.createR equestWith Param({
  375                    name : 'foo',
  376                    newn ame: 'bar'
  377                }, null) , res);
  378                expect(r es.status. calledWith (rdk.https tatus.not_ found)).to .be.true() ;
  379           }) ;
  380           it ('COPY res ponds HTTP  Conflict  when desti nation exi sts', func tion() {
  381  
  382                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  383                    call back(null,  db);
  384                });
  385  
  386                //POST n o source,  returns a  404 (not f ound)
  387                mockData .echo = cr eateDefini tionJson() ;
  388                definiti on.copyDef inition(mo ckReqResUt il.createR equestWith Param({
  389                    name : 'foo',
  390                    newn ame: 'bar'
  391                }, null) , res);
  392                expect(r es.status. calledWith (rdk.https tatus.conf lict)).to. be.true();
  393           }) ;
  394       });
  395  
  396       // Pat ientList t ests
  397       descri be('Patien t-list end point HTTP  response  codes', fu nction() {
  398           it ('GET resp onds HTTP  Not Found' , function () {
  399  
  400                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  401                    call back(null,  db);
  402                });
  403  
  404                //GET w/ name, and  return a s tatus 404  (not found )
  405                patientl ist.getPat ientList(m ockReqResU til.create RequestWit hParam(nul l, null),  res);
  406                expect(r es.status. calledWith (rdk.https tatus.not_ found)).to .be.true() ;
  407           }) ;
  408  
  409           it ('POST res ponds HTTP  Bad Reque st when re quired par ameter mis sing', fun ction() {
  410  
  411                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  412                    call back(null,  db);
  413                });
  414  
  415                //POST w /o name, r equired, a nd returns  a 400 (ba d request)
  416                mockData .testJson  = createPa tientlistJ son();
  417                patientl ist.postPa tientlist( mockReqRes Util.creat eRequestWi thParam(nu ll, mockDa ta.testJso n), res);
  418                expect(r es.status. calledWith (rdk.https tatus.bad_ request)). to.be.true ();
  419           }) ;
  420  
  421           it ('POST res ponds HTTP  Conflict' , function () {
  422  
  423                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  424                    call back(null,  db);
  425                });
  426  
  427                //POST p rovide req uired name  - echo -  exists
  428                mockData .testJson  = createPa tientlistJ son('patie ntlist1');
  429                mockData .echo = mo ckData.tes tJson;
  430                patientl ist.postPa tientlist( mockReqRes Util.creat eRequestWi thParam(nu ll, mockDa ta.testJso n), res);
  431                expect(r es.status. calledWith (rdk.https tatus.conf lict)).to. be.true();
  432           }) ;
  433  
  434           it ('POST res ponds HTTP  Created',  function( ) {
  435  
  436                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  437                    call back(null,  db);
  438                });
  439  
  440                //POST p rovide req uired name  - this sh ould creat e one, and  return a  status 201  (created)
  441                mockData .testJson  = createPa tientlistJ son('patie ntlist1');
  442                mockData .echo = {} ;
  443                patientl ist.postPa tientlist( mockReqRes Util.creat eRequestWi thParam(nu ll, mockDa ta.testJso n), res);
  444                expect(r es.status. calledWith (rdk.https tatus.crea ted)).to.b e.true();
  445           }) ;
  446  
  447           it ('DELETE r esponds HT TP Bad Req uest when  required p arameter m issing', f unction()  {
  448  
  449                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  450                    call back(null,  db);
  451                });
  452  
  453                //POST w /o name, r equired, a nd returns  a 400 (ba d request)
  454                mockData .testJson  = createPa tientlistJ son();
  455                patientl ist.delete Patientlis t(mockReqR esUtil.cre ateRequest WithParam( null, mock Data.testJ son), res) ;
  456                expect(r es.status. calledWith (rdk.https tatus.bad_ request)). to.be.true ();
  457           }) ;
  458  
  459           it ('COPY res ponds HTTP  Bad Reque st when re quired par ameter mis sing', fun ction() {
  460  
  461                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  462                    call back(null,  db);
  463                });
  464  
  465                //POST w /o name, r equired, a nd returns  a 400 (ba d request)
  466                mockData .testJson  = createPa tientlistJ son();
  467                patientl ist.copyPa tientlist( mockReqRes Util.creat eRequestWi thParam(nu ll, mockDa ta.testJso n), res);
  468                expect(r es.status. calledWith (rdk.https tatus.bad_ request)). to.be.true ();
  469           }) ;
  470           it ('COPY res ponds HTTP  Not Found  when sour ce missing ', functio n() {
  471  
  472                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  473                    call back(null,  db);
  474                });
  475  
  476                //POST n o source,  returns a  404 (not f ound)
  477                mockData .echo = nu ll;
  478                patientl ist.copyPa tientlist( mockReqRes Util.creat eRequestWi thParam({
  479                    name : 'foo',
  480                    newn ame: 'bar'
  481                }, null) , res);
  482                expect(r es.status. calledWith (rdk.https tatus.not_ found)).to .be.true() ;
  483           }) ;
  484           it ('COPY res ponds HTTP  Conflict  when desti nation exi sts', func tion() {
  485  
  486                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  487                    call back(null,  db);
  488                });
  489  
  490                //POST n o source,  returns a  404 (not f ound)
  491                mockData .echo = cr eatePatien tlistJson( );
  492                patientl ist.copyPa tientlist( mockReqRes Util.creat eRequestWi thParam({
  493                    name : 'foo',
  494                    newn ame: 'bar'
  495                }, null) , res);
  496                expect(r es.status. calledWith (rdk.https tatus.conf lict)).to. be.true();
  497           }) ;
  498       });
  499   });