304. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/2/2019 1:08:01 PM 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.

304.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\ARS_Frontend\ars-app\src\app\ewv\ewv-admin ewv-admin.component.spec.ts Wed Mar 27 19:18:26 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\ARS_Frontend\ars-app\src\app\ewv\ewv-admin ewv-admin.component.spec.ts Fri Mar 29 18:12:40 2019 UTC

304.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 572
Changed 2 4
Inserted 0 0
Removed 0 0

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

304.4 Active regular expressions

No regular expressions were active.

304.5 Comparison detail

  1   import { E wvAdminCom ponent } f rom './ewv -admin.com ponent';
  2   import { E wvViewerSe rvice } fr om './../e wv-viewer/ ewv-viewer .service';
  3   import { E wvAdminSer vice } fro m './ewv-a dmin.servi ce';
  4   import { A uthenticat ionService  } from '. /../../aut h/auth.ser vice';
  5   import { P dfReferenc eService }  from './. ./pdf-refe rence/pdf- reference. service';
  6   import { W indowRefSe rvice } fr om '../../ window-ref .service';
  7   import { A ppSettings Service }  from './.. /../shared /app-setti ngs/app-se ttings.ser vice';
  8   import { F ormBuilder  } from '@ angular/fo rms';
  9   import { P aginationS ettings }  from '../. ./shared/t able';
  10   import {
  11     SearchMo del,
  12     Paginati onModel
  13   } from './ ../../ars/ user-admin /user-admi n.model';  // need to  create ew vUserModel
  14   import { C reateUserR equest } f rom './ewv -admin-mod el';
  15  
  16   describe(' EwvAdminCo mponent',  () => {
  17     let comp onent: Ewv AdminCompo nent;
  18     let ewvV iewerServi ce: EwvVie werService ;
  19     let ewvA dminServic e: EwvAdmi nService;
  20     let auth entication Service: A uthenticat ionService ;
  21     let wind owRefServi ce: Window RefService ;
  22     let appS ettingsSer vice: AppS ettingsSer vice;
  23     let pdfR eferenceSe rvice: Pdf ReferenceS ervice;
  24     // befor eEach will  run befor e each tes t.
  25     beforeEa ch(() => {
  26       ewvVie werService  = new Ewv ViewerServ ice(null,  null);
  27       ewvAdm inService  = new EwvA dminServic e(null);
  28       authen ticationSe rvice = ne w Authenti cationServ ice(null,  null, null , null);
  29       window RefService  = new Win dowRefServ ice();
  30       appSet tingsServi ce = new A ppSettings Service(au thenticati onService,  null);
  31       pdfRef erenceServ ice = new  PdfReferen ceService( null);
  32       compon ent = new  EwvAdminCo mponent(
  33         ewvV iewerServi ce,
  34         new  FormBuilde r(),
  35         ewvA dminServic e,
  36         auth entication Service,
  37         wind owRefServi ce,
  38         appS ettingsSer vice,
  39         pdfR eferenceSe rvice
  40       );
  41     });
  42     it('shou ld be crea ted', () = > {
  43       expect (component ).toBeTrut hy();
  44     });
  45     it('shou ld test ng OnInit met hod', () = > {
  46       const  formInitSp y = spyOn( component,  'formInit ');
  47       const  setMenuSpy  = spyOn(c omponent,  'setMenu') ;
  48       compon ent.ngOnIn it();
  49      // expe ct(setMenu Spy).toHav eBeenCalle d();
  50       expect (component .tableSett ings.butto nShow).toE qual(true) ;
  51       expect (component .tableSett ings.butto nNames).to Equal(['Mo dify']);
  52       expect (formInitS py).toHave BeenCalled ();
  53     });
  54  
  55     // it('s hould test  setMenu m ethod', ()  => {
  56     //   con st menuDat a: MenuMod el = new M enuModel() ;
  57     //   //  const pdfL ist: DropD ownModel[]  = [new Dr opDownMode l(), new D ropDownMod el(), new  DropDownMo del()];
  58     //   con st getMenu Spy = spyO n(appSetti ngsService , 'getMenu ').and.cal lFake(() = > {
  59     //     r eturn new  Observable (observer  => observe r.next(men uData));
  60     //   });
  61     //   //  const popu latePdfRef MenuSpy =  spyOn(pdfR eferenceSe rvice, 'po pulatePdfR eferenceMe nu').and.c allFake(()  => {
  62     //   //    return n ew Observa ble(observ er => obse rver.next( pdfList));
  63     //   //  });
  64     //   com ponent.set Menu();
  65     //   exp ect(getMen uSpy).toHa veBeenCall ed();
  66     //   //  expect(pop ulatePdfRe fMenuSpy). toHaveBeen Called();
  67     //   exp ect(compon ent.ewvMen u).toEqual (menuData) ;
  68     //   //  expect(com ponent.ewv Menu.dropD ownGroups[ 1].dropdow ns).toEqua l(pdfList) ;
  69     // });
  70  
  71     // the f ollowing t ests shoul d test the  various t ypes of su ccess/erro r messages .
  72     it('shou ld test on UploadSucc ess method ', () => {
  73       const  uploadMess age = {
  74         msg:  'uploaded  successfu lly',
  75         stat us: true
  76       };
  77       const  setMenuSpy  = spyOn(c omponent,  'setMenu') ;
  78       compon ent.onUplo adSuccess( uploadMess age);
  79       expect (component .successMs g).toEqual (uploadMes sage.msg);
  80       expect (component .successSt atus).toEq ual(upload Message.st atus);
  81       expect (setMenuSp y).toHaveB eenCalled( );
  82     });
  83     it('shou ld test on UploadErro r method',  () => {
  84       const  uploadMess age = {
  85         msg:  'uploaded  failed',
  86         stat us: false
  87       };
  88       compon ent.onUplo adError(up loadMessag e);
  89       expect (component .errorMsg) .toEqual(u ploadMessa ge.msg);
  90       expect (component .errorStat us).toEqua l(uploadMe ssage.stat us);
  91     });
  92     it('shou ld test on ArchiveSuc cess metho d', () =>  {
  93       const  archiveMes sage = {
  94         msg:  'pdf arch ived succe ssfully',
  95         stat us: true
  96       };
  97       const  setMenuSpy  = spyOn(c omponent,  'setMenu') ;
  98       compon ent.onArch iveSuccess (archiveMe ssage);
  99       expect (component .archiveSu ccessMsg). toEqual(ar chiveMessa ge.msg);
  100       expect (component .archiveSu ccessStatu s).toEqual (archiveMe ssage.stat us);
  101       expect (setMenuSp y).toHaveB eenCalled( );
  102     });
  103  
  104     it('shou ld test on ArchiveErr or method' , () => {
  105       const  archiveErr orMessage  = {
  106         msg:  'pdf arch ived faile d',
  107         stat us: false
  108       };
  109       compon ent.onArch iveError(a rchiveErro rMessage);
  110       expect (component .archiveEr rorMsg).to Equal(arch iveErrorMe ssage.msg) ;
  111       expect (component .archiveEr rorStatus) .toEqual(a rchiveErro rMessage.s tatus);
  112     });
  113  
  114     // follo wing test  should tes t the form  and it's  validators .
  115     it('shou ld test al l forms we re created ', () => {
  116       compon ent.formIn it();
  117       expect (component .createFor m).toBeTru thy();
  118       expect (component .searchFor m).toBeTru thy();
  119       expect (component .modifyFor m).toBeTru thy();
  120     });
  121     it('shou ld test cr eateForm v alidation' , () => {
  122       compon ent.formIn it();
  123       // **  Testing cr eateForm * * //
  124  
  125       // tes ting requi red
  126       compon ent.create Form.get(' userName') .setValue( '');
  127       expect (component .createFor m.get('use rName').va lid).toBeF alsy();
  128  
  129       // tes ting unacc epted valu es
  130       compon ent.create Form.get(' userName') .setValue( '[()],');
  131       expect (component .createFor m.get('use rName').va lid).toBeT ruthy();
  132       // tes ting unacc epted valu es
  133       compon ent.create Form.get(' phone').se tValue('te st');
  134       expect (component .createFor m.get('pho ne').valid ).toBeFals y();
  135       // tes ting regex  pattern
  136       compon ent.create Form.get(' email').se tValue('te st@va');
  137       expect (component .createFor m.get('ema il').valid ).toBeFals y();
  138       // tes ting requi red
  139       compon ent.create Form.get(' email').se tValue('') ;
  140       expect (component .createFor m.get('ema il').valid ).toBeFals y();
  141       // tes ing valid
  142       compon ent.create Form.get(' userName') .setValue( 'vhaTest') ;
  143       expect (component .createFor m.get('use rName').va lid).toBeT ruthy();
  144       // tes ting valid
  145       compon ent.create Form.get(' phone').se tValue('32 15554444') ;
  146       expect (component .createFor m.get('pho ne').valid ).toBeTrut hy();
  147       // tes ting valid
  148         component. createForm .get('emai l').setVal ue('test@ DOMAIN ');
  149       expect (component .createFor m.get('ema il').valid ).toBeTrut hy();
  150       expect (component .createFor m.valid).t oBeTruthy( );
  151  
  152       // **  End of Tes ting creat eForm ** / /
  153     });
  154     it('shou ld test se archForm v alidation' , () => {
  155       // **  Testing se archForm * * //
  156  
  157       compon ent.formIn it();
  158       // tes ting requi red
  159       compon ent.search Form.get(' userName') .setValue( '');
  160       expect (component .searchFor m.get('use rName').va lid).toBeF alsy();
  161       // tes ting unacc epted valu es
  162       compon ent.search Form.get(' userName') .setValue( '[]({,');
  163       expect (component .searchFor m.get('use rName').va lid).toBeT ruthy();
  164       // tes ting valid
  165       compon ent.search Form.get(' userName') .setValue( 'vhaTest') ;
  166       expect (component .searchFor m.get('use rName').va lid).toBeT ruthy();
  167       expect (component .searchFor m.valid).t oBeTruthy( );
  168  
  169       // **  End of Tes ting searc hForm ** / /
  170     });
  171     it('shou ld test mo difyForm v alidation' , () => {
  172       // **  Testing mo difyForm * * //
  173       compon ent.formIn it();
  174       // tes ting unacc epted valu es
  175       compon ent.modify Form
  176         .get ('editPhon e')
  177         .set Value('thi s is not a  phone num ber');
  178       expect (component .modifyFor m.get('edi tPhone').v alid).toBe Falsy();
  179       // tes ting unacc epted valu es
  180       compon ent.modify Form.get(' editEmail' ).setValue ('this is  not a vali d email');
  181       expect (component .modifyFor m.get('edi tEmail').v alid).toBe Falsy();
  182       // tes ting requi red
  183       compon ent.modify Form.get(' editEmail' ).setValue ('');
  184       expect (component .modifyFor m.get('edi tEmail').v alid).toBe Falsy();
  185       // tes ting valid
  186       compon ent.modify Form.get(' editPhone' ).setValue ('32155544 44');
  187       expect (component .modifyFor m.get('edi tPhone').v alid).toBe Truthy();
  188       // tes ting valid
  189         component. modifyForm .get('edit Email').se tValue('vh aTest@ DOMAIN ');
  190       expect (component .modifyFor m.get('edi tEmail').v alid).toBe Truthy();
  191       // tes ting valid
  192       expect (component .modifyFor m.valid).t oBeTruthy( );
  193       // **  End of Tes ting modif yForm ** / /
  194     });
  195     it('shou ld test se arch metho d', () =>  {
  196       const  fetchDataS py = spyOn (component , 'fetchDa ta');
  197       compon ent.search UserClicke d = false;
  198       compon ent.search ();
  199       expect (component .searchUse rClicked). toEqual(tr ue);
  200       expect (component .paginatio nSettings) .toEqual(n ew Paginat ionSetting s());
  201       expect (fetchData Spy).toHav eBeenCalle d();
  202     });
  203     // it('s hould test  fetchData  method',  () => {
  204     //   com ponent.sea rchModel.u serName =  'vhaTest';
  205     //   con st data =  {
  206     //     r esponse: [ new UserMo del(), new  UserModel ()]
  207     //   };
  208     //   con st getUser InfoSpy =  spyOn(ewvA dminServic e, 'getUse rInfo').an d.callFake (
  209     //     ( ) => {
  210     //        return ne w Observab le(observe r => obser ver.next(d ata));
  211     //     }
  212     //   );
  213     //   com ponent.loa ding = fal se;
  214     //   com ponent.sea rchUserCli cked = tru e;
  215     //   com ponent.fet chData();
  216     //   exp ect(compon ent.search Results).t oEqual(dat a.response );
  217     //   exp ect(compon ent.loadin g).toBeFal sy();
  218     //   exp ect(compon ent.showRe sults).toB eTruthy();
  219     //   exp ect(compon ent.errorS tatus).toB eFalsy();
  220     //   exp ect(getUse rInfoSpy). toHaveBeen Called();
  221     // });
  222     it('shou ld test up dateTable  method', ( ) => {
  223       const  fetchDataS py = spyOn (component , 'fetchDa ta');
  224       compon ent.update Table();
  225       expect (fetchData Spy).toHav eBeenCalle d();
  226     });
  227     it('shou ld test li stAllUsers  method',  () => {
  228       compon ent.search UserClicke d = true;
  229       const  clearMsgsS py = spyOn (component , 'clearMs gs');
  230       const  fetchDataS py = spyOn (component , 'fetchDa ta');
  231       compon ent.listAl lUsers();
  232       expect (component .searchUse rClicked). toEqual(fa lse);
  233       expect (clearMsgs Spy).toHav eBeenCalle d();
  234       expect (fetchData Spy).toHav eBeenCalle d();
  235       expect (component .paginatio nSettings) .toEqual(n ew Paginat ionSetting s());
  236     });
  237     it('shou ld test re setSearchF orm method ', () => {
  238       const  formInitSp y = spyOn( component,  'formInit ');
  239       const  clearMsgsS py = spyOn (component , 'clearMs gs');
  240       compon ent.showRe sults = tr ue;
  241       compon ent.search UserClicke d = true;
  242       compon ent.resetS earchForm( );
  243       expect (formInitS py).toHave BeenCalled ();
  244       expect (clearMsgs Spy).toHav eBeenCalle d();
  245       expect (component .searchMod el).toEqua l(new Sear chModel()) ;
  246       expect (component .paginatio nModel).to Equal(new  Pagination Model());
  247       expect (component .showResul ts).toEqua l(false);
  248       expect (component .searchUse rClicked). toEqual(fa lse);
  249     });
  250     it('shou ld test cl earMsgs me thod', ()  => {
  251       compon ent.errorM sg = 'erro r';
  252       compon ent.errorS tatus = tr ue;
  253       compon ent.succes sMsg = 'su ccess';
  254       compon ent.succes sStatus =  true;
  255       compon ent.clearM sgs();
  256       expect (component .errorMsg) .toEqual(' ');
  257       expect (component .successMs g).toEqual ('');
  258       expect (component .errorStat us).toEqua l(false);
  259       expect (component .successSt atus).toEq ual(false) ;
  260     });
  261     it('shou ld test re setCreateF orm method ', () => {
  262       const  formInitSp y = spyOn( component,  'formInit ');
  263       const  clearMsgsS py = spyOn (component , 'clearMs gs');
  264       compon ent.enable Edit = tru e;
  265       compon ent.enable Export = t rue;
  266       compon ent.isAdmi n = true;
  267       compon ent.status  = false;
  268       compon ent.resetC reateForm( );
  269       expect (formInitS py).toHave BeenCalled ();
  270       expect (clearMsgs Spy).toHav eBeenCalle d();
  271       expect (component .enableEdi t).toEqual (false);
  272       expect (component .enableExp ort).toEqu al(false);
  273       expect (component .isAdmin). toEqual(fa lse);
  274       expect (component .status).t oEqual(tru e);
  275       expect (component .requestMo del).toEqu al(new Cre ateUserReq uest());
  276     });
  277     it('shou ld test bu ttonClicke d method',  () => {}) ;
  278   });
  279  
  280   // buttonC licked(eve nt) {
  281   //   // if  (event.bu ttonName = == 'Modify ') {
  282   //   this. openEditMo dal(event) ;
  283   //   // }
  284   //   // el se {
  285   //   //    this.openD eleteModal (event);
  286   //   //    // this.de lete(event );
  287   //   // }
  288   // }