Skip to content
Snippets Groups Projects
output-list.component.spec.ts 1.76 KiB
Newer Older
  • Learn to ignore specific revisions
  • import { TestBed, waitForAsync, ComponentFixture  } from '@angular/core/testing';
    import { RouterTestingModule } from '@angular/router/testing';
    
    import { OutputListComponent } from './output-list.component';
    import { Attribute } from '../../../metamodel/models';
    
    const ATTRIBUTE_LIST: Attribute[] = [
        {
            id: 2,
            name: 'name_two',
            label: 'label_two',
            form_label: 'form_label_two',
            description : 'description_two',
            output_display: 1,
            criteria_display: 1,
            search_flag : 'SPECTRUM_1D',
            search_type : 'field',
            operator : '=',
            type: '',
            display_detail: 1
        },
        {
            id: 1,
            name: 'name_one',
            label: 'label_one',
            form_label: 'form_label_one',
            description: 'description_one',
            output_display: 2,
            criteria_display: 2,
            search_flag: 'ID',
            search_type: 'field',
            operator: '=',
            type: 'integer',
            display_detail: 2
        }
    ];
    
    describe('OutputListComponent', () => {
        let component: OutputListComponent;
        let fixture: ComponentFixture<OutputListComponent>;
    
        beforeEach(waitForAsync(() => {
            TestBed.configureTestingModule({
                imports: [RouterTestingModule],
                declarations: [OutputListComponent]
            }).compileComponents();
            fixture = TestBed.createComponent(OutputListComponent);
            component = fixture.componentInstance;
        }));
    
        it('should create the component', () => {
            expect(component).toBeDefined();
        });
    
        it('should information in HTML file', () => {
            component.datasetSelected = 'myTestDataset';
            component.attributeList = ATTRIBUTE_LIST;
            fixture.detectChanges();
            expect(fixture).toMatchSnapshot();
        });
    });