<div class="form-group container-representant-inactif">
  <h3>{{'LZ01.Demande.OngletRepInactifs' | obtenirRessource}}</h3>
  <table #tableauRepresentantDesactive datatable [dtOptions]="dtOptionsDesactive" class="tableau"
    *ngIf="tblRepresentantsDesactives.length !== 0">
    <thead class="header">
      <tr>
        <th>{{'LZ01.Demande.Nom' | obtenirRessource}}</th>
        <th>{{'LZ01.Demande.PersonneRessource' | obtenirRessource}}</th>
        <th>{{'LZ01.Representant.TypeDoc' | obtenirRessource}}</th>
        <th>{{'LZ01.Demande.DateInscription' | obtenirRessource}}</th>
        <th>{{'LZ01.Demande.Daterevocation' | obtenirRessource}}</th>
        <th>{{'LZ01.Commun.Tableau.Actions' | obtenirRessource}}</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor="let representant of tblRepresentantsDesactives; let id = index">
        <td>
          <infos-representants [representant]="representant">
          </infos-representants>
        </td>
        <td>
          <span *ngIf="!representant.personneContact.nom && !representant.personneContact.prenom"> -- </span>
          <span *ngIf="(!!representant.neq || !!representant.nomEntrepriseHorsQuebec || !!representant.nomEntreprise) &&
                    !!representant.personneContact.nom && !!representant.personneContact.prenom">
            {{representant.personneContact.nom}}, {{representant.personneContact.prenom}}</span>
        </td>
        <td>
          <span
            *ngIf="representant.representantFormulaireProcuration.indFormulaireValid">{{obtenirDescriptionDocument(representant.representantFormulaireProcuration?.codeFormulaireProcuration)}}</span>
          <span
            *ngIf="!representant.representantFormulaireProcuration.indFormulaireValid">{{obtenirDescriptionRaisonNonValidite(representant.representantFormulaireProcuration?.codeRaisonRejetFormulaire)}}</span>
        </td>
        <td>
          <span *ngIf="!!representant.dateDebut">
            {{ representant.dateDebut|mask: '0000-00-00' }}</span>
        </td>
        <td>
          <span *ngIf="!!representant.dateFin">
            {{ representant.dateFin|mask: '0000-00-00' }}</span>
        </td>
        <td>
          <button appTabulationFocus class="button bouton-outils icon-sans-texte icon-consulter"></button>
        </td>
      </tr>
    </tbody>
  </table>
  <p *ngIf="tblRepresentantsDesactives.length === 0">
    {{'LZ01.Demande.MessAucun' | obtenirRessource}}</p>
</div>
 
body {
  font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
  background-color: #fff;
}
 
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TableauRepresentantsDesactivesComponent } from './tableau-representants-desactives.component';
import { retourListeRepresentantsDesactivesMock } from 'src/testing/modeles/retour-liste-representantsDesactives.mock';
import { retourListeRaisonnonValiditeMock } from 'src/testing/modeles/retour-liste-raison-non-validite.mock';
import { retourListeFormulaireProcurationMock } from 'src/testing/modeles/retour-liste-formulaire-procuration.mock';
import { of } from 'rxjs';
import { ParametresM1Service } from 'src/app/noyau/services/parametres-m1/parametres-m1.service';
import { MaskPipeMock } from 'src/testing/pipe/mask.pipe.mock';
import { RessourcePipeMock } from 'src/testing/pipe/ressource.pipe.mock';
import { HttpClientModule } from '@angular/common/http';
import { DataTablesModule } from 'angular-datatables';
import { ActivatedRoute, Router } from '@angular/router';
import { MessageService } from 'src/app/noyau/services/message/message.service';
import { NO_ERRORS_SCHEMA } from '@angular/core';
describe('TableauRepresentantsDesactivesComponent', () => {
  let component: TableauRepresentantsDesactivesComponent;
  let fixture: ComponentFixture<TableauRepresentantsDesactivesComponent>;
  let parametresM1ServiceSpy: {
    obtenirListeRaisonNonValidite: jasmine.Spy,
    obtenirListeFormulaireProcuration: jasmine.Spy
  };
  const router = { navigate: jasmine.createSpy('navigate') };
  const noDemande = '12345';
  const activatedRoute = of({
    noSeq: '1002003000',
    noDemande: '500600'
  });
  let messageServiceSpy: {
    ajouterMessage: jasmine.Spy
  };
  beforeEach(async(() => {
    parametresM1ServiceSpy = jasmine.createSpyObj('ParametresM1Service', ['obtenirListeRaisonNonValidite',
    'obtenirListeFormulaireProcuration']);
    parametresM1ServiceSpy.obtenirListeRaisonNonValidite.and.returnValue(of(retourListeRaisonnonValiditeMock));
    parametresM1ServiceSpy.obtenirListeFormulaireProcuration.and.returnValue(of(retourListeFormulaireProcurationMock));
    
    TestBed.configureTestingModule({
      declarations: [ TableauRepresentantsDesactivesComponent, MaskPipeMock, RessourcePipeMock ],
      imports: [HttpClientModule, DataTablesModule],
      providers: [
        { provide: ActivatedRoute, useValue: { params: activatedRoute } },
        { provide: Router, useValue: router },
        { provide: MessageService, useValue: messageServiceSpy },
        { provide: ParametresM1Service, useValue: parametresM1ServiceSpy }
      ],
      schemas: [NO_ERRORS_SCHEMA]
    })
    .compileComponents();
  }));
  beforeEach(() => {
    fixture = TestBed.createComponent(TableauRepresentantsDesactivesComponent);
    component = fixture.componentInstance;
    component.tblRepresentantsDesactives = retourListeRepresentantsDesactivesMock;
    fixture.detectChanges();
  });
  it('should create', () => {
    expect(component).toBeTruthy();
  });
  it('Le component est créé', () => {
    expect(component).toBeTruthy();
  });
  it('obtenirDescriptionDocument(): devrait retourner la type de formulaire du document valide', () => {
    // Arrange
    // Act
    component.ngOnInit();
    // Assert
    expect(component.obtenirDescriptionDocument(retourListeFormulaireProcurationMock[0].code))
      .toEqual(retourListeFormulaireProcurationMock[0].description);
  });
  it('obtenirDescriptionRaisonNonValidite(): devrait retourner la raison de non validité du document', () => {
    // Arrange
    // Act
    component.ngOnInit();
    // Assert
    expect(component.obtenirDescriptionRaisonNonValidite(retourListeRaisonnonValiditeMock[0].codeRaison))
      .toEqual(retourListeRaisonnonValiditeMock[0].descriptionRaison);
  });
});
Output

This bin was created anonymously and its free preview time has expired. Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers