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

300.1 Files compared

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

300.2 Comparison summary

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

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

300.4 Active regular expressions

No regular expressions were active.

300.5 Comparison detail

  1   import { U serAdminCo mponent }  from './us er-admin.c omponent';
  2   import { F ormBuilder  } from '@ angular/fo rms';
  3   import { U serAdminSe rvice } fr om './user -admin.ser vice';
  4   import { P aginationS ettings }  from '../. ./shared/t able';
  5   import { O bservable  } from 'rx js/Observa ble';
  6   import 'rx js/add/obs ervable/th row';
  7   import 'rx js/add/obs ervable/of ';
  8   import { A uthenticat ionService  } from '. ./../auth/ auth.servi ce';
  9   import { A ppSettings Service }  from './.. /../shared /app-setti ngs/app-se ttings.ser vice';
  10  
  11   import { P aginationM odel, User RequestMod el } from  './user-ad min.model' ;
  12  
  13   describe(' UserAdminC omponent',  () => {
  14     let fb:  FormBuilde r;
  15     let user AdminServi ce: UserAd minService ;
  16     let comp onent: Use rAdminComp onent;
  17     let auth entication Service: A uthenticat ionService ;
  18     let appS ettingsSer vice: AppS ettingsSer vice;
  19  
  20     beforeEa ch(() => {
  21       fb = n ew FormBui lder();
  22       userAd minService  = new Use rAdminServ ice(null);
  23       authen ticationSe rvice = ne w Authenti cationServ ice(null,  null, null , null);
  24       appSet tingsServi ce = new A ppSettings Service(au thenticati onService,  null);
  25       compon ent = new  UserAdminC omponent(
  26         fb,
  27         user AdminServi ce,
  28         auth entication Service,
  29         appS ettingsSer vice
  30       );
  31     });
  32  
  33     it('shou ld be crea ted', () = > {
  34       expect (component ).toBeTrut hy();
  35     });
  36  
  37     it('test  ngOnInit  method', ( ) => {
  38       const  formInitSp y = spyOn( component,  'formInit ');
  39       compon ent.tableS ettings.bu ttonShow =  false;
  40       const  appSetting sServiceSp y = spyOn(
  41         appS ettingsSer vice,
  42         'get Menu'
  43       ).and. callFake(( ) => new O bservable( observer = > observer .next('')) );
  44       compon ent.ngOnIn it();
  45  
  46       expect (appSettin gsServiceS py).toHave BeenCalled ();
  47       expect (formInitS py).toHave BeenCalled ();
  48       expect (component .tableSett ings.butto nShow).toB eTruthy();
  49       expect (component .tableSett ings.butto nNames).to Equal(['Mo dify']);
  50     });
  51  
  52     it('test  formInit  method: ve rify appro priate for ms have be en instant iated', ()  => {
  53       compon ent.formIn it();
  54  
  55       expect (component .createFor m).toBeDef ined();
  56       expect (component .createFor m).not.toE qual(null) ;
  57  
  58       expect (component .searchFor m).toBeDef ined();
  59       expect (component .searchFor m).not.toE qual(null) ;
  60  
  61       expect (component .modifyFor m).toBeDef ined();
  62       expect (component .modifyFor m).not.toE qual(null) ;
  63     });
  64  
  65     it('test  formInit  method: ve rify some  basic oper ations on  forms', ()  => {
  66       compon ent.formIn it();
  67  
  68       compon ent.create Form.get(' userName') .setValue( 'hi');
  69       expect (component .createFor m.get('use rName').va lid).toBeT ruthy();
  70  
  71       compon ent.create Form.get(' userName') .setValue( '');
  72       expect (component .createFor m.get('use rName').va lid).toBeF alsy();
  73  
  74       // *** ********** ********** ********** ********** ********** ********** ********
  75  
  76       compon ent.create Form.get(' phone').se tValue('12 3');
  77       expect (component .createFor m.get('pho ne').valid ).toBeTrut hy();
  78  
  79       compon ent.create Form.get(' phone').se tValue('ab c');
  80       expect (component .createFor m.get('pho ne').valid ).toBeFals y();
  81  
  82       // nex t form
  83       // *** ********** ********** ********** ********** ********** ********** ********
  84       // *** ********** ********** ********** ********** ********** ********** ********
  85  
  86       compon ent.search Form.get(' userName') .setValue( 'hi');
  87       expect (component .searchFor m.get('use rName').va lid).toBeT ruthy();
  88  
  89       compon ent.search Form.get(' userName') .setValue( '');
  90       expect (component .searchFor m.get('use rName').va lid).toBeF alsy();
  91  
  92       // nex t form
  93       // *** ********** ********** ********** ********** ********** ********** ********
  94       // *** ********** ********** ********** ********** ********** ********** ********
  95  
  96       compon ent.modify Form.get(' editPhone' ).setValue ('123');
  97       expect (component .modifyFor m.get('edi tPhone').v alid).toBe Truthy();
  98  
  99       compon ent.modify Form.get(' editPhone' ).setValue ('abc');
  100       expect (component .modifyFor m.get('edi tPhone').v alid).toBe Falsy();
  101  
  102       expect (component .createFor m).toBeTru thy();
  103       expect (component .searchFor m).toBeTru thy();
  104       expect (component .modifyFor m).toBeTru thy();
  105     });
  106  
  107     it('test  search me thod', ()  => {
  108       compon ent.search UserClicke d = false;
  109       compon ent.pagina tionSettin gs = new P aginationS ettings();
  110       compon ent.pagina tionSettin gs.sortCol umn = 'sor t';
  111       const  fetchDataS py = spyOn (component , 'fetchDa ta');
  112  
  113       compon ent.search ();
  114  
  115       expect (component .searchUse rClicked). toBeTruthy ();
  116       expect (component .paginatio nSettings. sortColumn ).toEqual( '');
  117       expect (fetchData Spy).toHav eBeenCalle d();
  118     });
  119  
  120     // it('t est fetchD ata method  with sear chUserClic ked false  and an err or', () =>  {
  121     //   com ponent.sea rchUserCli cked = fal se;
  122  
  123     //   con st getUser InfoSpy =  spyOn(user AdminServi ce, 'getAl lUsers').a nd.callFak e(
  124     //     ( ) => new O bservable( observer = > observer .next({ er rorCode: t rue }))
  125     //   );
  126     //   com ponent.fet chData();
  127  
  128     //   exp ect(compon ent.errorM sg).toEqua l('');
  129     // });
  130  
  131     // it('t est fetchD ata method  with sear chUserClic ked false  and no err or', () =>  {
  132     //   com ponent.sea rchUserCli cked = fal se;
  133  
  134     //   con st getUser InfoSpy =  spyOn(user AdminServi ce, 'getAl lUsers').a nd.callFak e(
  135     //     ( ) => new O bservable( observer = > observer .next({ er rorCode: f alse }))
  136     //   );
  137  
  138     //   com ponent.fet chData();
  139  
  140     //   exp ect(compon ent.errorM sg).toEqua l('');
  141     //   exp ect(compon ent.showRe sults).toB eTruthy();
  142     // });
  143  
  144     it('test  updateTab le method' , () => {
  145       const  updateTabl eSpy = spy On(compone nt, 'fetch Data');
  146       compon ent.update Table();
  147  
  148       expect (updateTab leSpy).toH aveBeenCal led();
  149     });
  150  
  151     it('test  listAllUs ers method ', () => {
  152       compon ent.search UserClicke d = true;
  153       const  fetchDataS py = spyOn (component , 'fetchDa ta');
  154  
  155       compon ent.listAl lUsers();
  156  
  157       expect (component .searchUse rClicked). toBeFalsy( );
  158       expect (component .paginatio nSettings) .toEqual(n ew Paginat ionSetting s());
  159       expect (fetchData Spy).toHav eBeenCalle d();
  160     });
  161  
  162     it('test  resetSear chForm met hod', () = > {
  163       compon ent.showRe sults = tr ue;
  164       const  clearMsgsS py = spyOn (component , 'clearMs gs');
  165  
  166       compon ent.resetS earchForm( );
  167  
  168       expect (component .showResul ts).toBeFa lsy();
  169       expect (component .paginatio nModel).to Equal(new  Pagination Model());
  170       expect (clearMsgs Spy).toHav eBeenCalle d();
  171     });
  172  
  173     it('test  clearMsgs  method',  () => {
  174       compon ent.errorS tatus = tr ue;
  175       compon ent.clearM sgs();
  176  
  177       expect (component .errorStat us).toBeFa lsy();
  178     });
  179  
  180     it('test  resetCrea teForm met hod', () = > {
  181       const  clearMsgsS py = spyOn (component , 'clearMs gs');
  182       compon ent.reques tModel = n ew UserReq uestModel( );
  183       // com ponent.req uestModel. edit = 'so mething';
  184       compon ent.enable Edit = tru e;
  185       compon ent.resetC reateForm( );
  186  
  187       // exp ect(compon ent.enable Edit).toBe Falsy();
  188       expect (clearMsgs Spy).toHav eBeenCalle d();
  189       expect (component .requestMo del).toEqu al(new Use rRequestMo del());
  190     });
  191  
  192     it('test  buttonCli cked metho d with but tonName se t to Modif y', () =>  {
  193       const  openEditMo dalSpy = s pyOn(compo nent, 'ope nEditModal ');
  194  
  195       const  inputEvent  = { butto nName: 'Mo dify' };
  196       compon ent.button Clicked(in putEvent);
  197  
  198       expect (openEditM odalSpy).t oHaveBeenC alled();
  199       expect (openEditM odalSpy).t oHaveBeenC alledWith( inputEvent );
  200     });
  201  
  202     it('test  buttonCli cked metho d', () =>  {
  203       spyOn( component,  'openEdit Modal');
  204  
  205       const  inputEvent  = { butto nName: fal se };
  206       compon ent.button Clicked(in putEvent);
  207  
  208       expect (component .openEditM odal).toHa veBeenCall ed();
  209       expect (component .openEditM odal).toHa veBeenCall edWith(inp utEvent);
  210     });
  211  
  212     it('test  openEditM odal metho d', () =>  {
  213       compon ent.modalC losed = tr ue;
  214       spyOn( component,  'setCusto mValidator ');
  215  
  216       const  inputUserR equestMode l = new Us erRequestM odel();
  217       // inp utUserRequ estModel.e xport = 'N o';
  218       const  inputEvent  = { row:  inputUserR equestMode l };
  219       compon ent.openEd itModal(in putEvent);
  220  
  221       expect (component .setCustom Validator) .toHaveBee nCalled();
  222       expect (component .setCustom Validator) .toHaveBee nCalledWit h(
  223         comp onent.modi fyForm,
  224         comp onent.user ValueBefor eChange
  225       );
  226  
  227       expect (component .modalClos ed).toBeFa lsy();
  228       expect (component .editReque stModel).t oEqual({ . ..inputEve nt.row });
  229       expect (component .userValue BeforeChan ge).toEqua l({ ...inp utEvent.ro w });
  230       expect (component .modifyEna bleExport) .toEqual(f alse);
  231     });
  232  
  233     it('test  createUse r method w ith error' , () => {
  234       compon ent.enable Export = t rue;
  235       compon ent.enable Edit = tru e;
  236       compon ent.isAdmi n = true;
  237  
  238       const  createUser Spy = spyO n(userAdmi nService,  'createUse r').and.ca llFake(
  239         () = >
  240           ne w Observab le(observe r =>
  241              observer.n ext({ erro rCode: tru e, message : 'message ' })
  242           )
  243       );
  244  
  245       spyOn( authentica tionServic e, 'getDec odedUserIn fo').and.c allFake(()  => {
  246         retu rn {
  247             userName:  ' AI '
  248         };
  249       });
  250  
  251       compon ent.create User();
  252  
  253       // exp ect(compon ent.reques tModel.exp ort).toEqu al('N');
  254       // exp ect(compon ent.reques tModel.edi t).toEqual ('N');
  255       // exp ect(compon ent.reques tModel.adm in).toEqua l('N');
  256       expect (component .requestMo del.create dBy).toEqu al('');
  257       expect (component .errorMsg) .toEqual(' ');
  258     });
  259  
  260     it('test  createUse r method w ithout err or', () =>  {
  261       spyOn( authentica tionServic e, 'getDec odedUserIn fo').and.c allFake(()  => {
  262         retu rn {
  263             userName:  ' AI '
  264         };
  265       });
  266       compon ent.enable Export = t rue;
  267       compon ent.enable Edit = tru e;
  268       compon ent.isAdmi n = true;
  269  
  270       const  createUser Spy = spyO n(userAdmi nService,  'createUse r').and.ca llFake(
  271         () = > new Obse rvable(obs erver => o bserver.ne xt({ error Code: fals e }))
  272       );
  273  
  274       compon ent.create User();
  275  
  276       // exp ect(compon ent.reques tModel.exp ort).toEqu al('N');
  277       // exp ect(compon ent.reques tModel.edi t).toEqual ('N');
  278       // exp ect(compon ent.reques tModel.adm in).toEqua l('N');
  279       expect (component .requestMo del.create dBy).toEqu al('');
  280       expect (component .successMs g).toEqual ('User was  successfu lly create d.');
  281     });
  282  
  283     it('test  modifyUse r method',  () => {
  284       const  getDecoder UserInfoRe turnData =  { userNam e: 'USER_N AME' };
  285       spyOn( authentica tionServic e, 'getDec odedUserIn fo').and.c allFake(
  286         () = > getDecod erUserInfo ReturnData
  287       );
  288  
  289       const  observable Subscripti on = Obser vable.of({ });
  290       spyOn( userAdminS ervice, 'm odifyUser' ).and.retu rnValue(
  291         obse rvableSubs cription
  292       );
  293  
  294       spyOn( component. subscripti on, 'add') ;
  295       spyOn( component,  'fetchDat a');
  296  
  297       compon ent.succes sMsg = nul l;
  298       compon ent.succes sStatus =  null;
  299       compon ent.errorM sg = null;
  300       compon ent.errorS tatus = nu ll;
  301       compon ent.pagina tionSettin gs = null;
  302  
  303       compon ent.search UserClicke d = false;
  304       compon ent.modify User();
  305  
  306       expect (component .errorMsg) .toEqual(' ');
  307       expect (component .errorStat us).toEqua l(false);
  308       expect (component .successMs g).toEqual ('User was  successfu lly modifi ed.');
  309       expect (component .successSt atus).toEq ual(true);
  310  
  311       expect (component .paginatio nSettings) .toBeDefin ed();
  312       expect (component .paginatio nSettings) .not.toEqu al(null);
  313  
  314       expect (component .editReque stModel.mo difiedBy). toEqual('U SER_NAME') ;
  315       expect (component .modalClos ed).toEqua l(true);
  316  
  317       expect (userAdmin Service.mo difyUser). toHaveBeen Called();
  318       expect (userAdmin Service.mo difyUser). toHaveBeen CalledWith (
  319         comp onent.edit RequestMod el
  320       );
  321  
  322       expect (component .fetchData ).toHaveBe enCalled() ;
  323       expect (component .subscript ion.add).t oHaveBeenC alled();
  324     });
  325  
  326     it('test  onModalCl ose method ', () => {
  327       compon ent.onModa lClose({}) ;
  328       expect (component .modalClos ed).toEqua l(true);
  329     });
  330  
  331     it('test  resetModa l method',  () => {
  332       const  initalUser RequestMod el = new U serRequest Model();
  333       expect (component .editReque stModel).t oEqual(ini talUserReq uestModel) ;
  334       compon ent.modalC losed = fa lse;
  335  
  336       compon ent.userVa lueBeforeC hange = ne w UserRequ estModel() ;
  337       compon ent.userVa lueBeforeC hange.user Name = 'US ER_NAME';
  338       compon ent.userVa lueBeforeC hange.doma in = 'DOMA IN';
  339       // com ponent.use rValueBefo reChange.s tatus = 'N ';
  340       // com ponent.use rValueBefo reChange.e xport = 'Y ';
  341       // com ponent.use rValueBefo reChange.e dit = 'Y';
  342       // com ponent.use rValueBefo reChange.a dmin = 'Y' ;
  343       compon ent.userVa lueBeforeC hange.crea tedBy = 'C REATED_BY' ;
  344       compon ent.userVa lueBeforeC hange.phon e = 123456 7890;
  345       compon ent.userVa lueBeforeC hange.emai l = 'E-MAI L';
  346       compon ent.userVa lueBeforeC hange.last Name = 'LA ST_NAME';
  347       compon ent.userVa lueBeforeC hange.firs tName = 'F IRST_NAME' ;
  348       compon ent.userVa lueBeforeC hange.modi fiedBy = ' MODIFIED_B Y';
  349       compon ent.userVa lueBeforeC hange.user Id = 55545 6789;
  350  
  351       compon ent.resetM odal();
  352  
  353       expect (component .editReque stModel).t oEqual({
  354         ...c omponent.u serValueBe foreChange
  355       });
  356       expect (component .modalClos ed).toEqua l(true);
  357     });
  358  
  359     it('test  ngOnDestr oy method' , () => {
  360       spyOn( component. subscripti on, 'unsub scribe');
  361       compon ent.ngOnDe stroy();
  362       expect (component .subscript ion.unsubs cribe).toH aveBeenCal led();
  363     });
  364  
  365     it('test  setCustom Validator  method', ( ) => {
  366       const  form = fb. group({});
  367       spyOn( form, 'set Validators ');
  368       spyOn( form, 'upd ateValueAn dValidity' );
  369  
  370       const  initialObj ect = new  UserReques tModel();
  371       compon ent.setCus tomValidat or(form, i nitialObje ct);
  372  
  373       expect (form.setV alidators) .toHaveBee nCalled();
  374       expect (form.upda teValueAnd Validity). toHaveBeen Called();
  375     });
  376   });