import { SimpleChange } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { airlineCodes } from './../../../shared/airlines';
import { PartnersRedirectNoteComponent } from './partners-redirect-note.component';

describe('PartnersRedirectNoteComponent', () => {
    let component: PartnersRedirectNoteComponent;
    let fixture: ComponentFixture<PartnersRedirectNoteComponent>;

    beforeEach(async () => {
        await TestBed.configureTestingModule({
            declarations: [PartnersRedirectNoteComponent],
        }).compileComponents();
    });

    beforeEach(() => {
        fixture = TestBed.createComponent(PartnersRedirectNoteComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
    });

    it('should create', () => {
        expect(component).toBeTruthy();
    });

    it('should filter parters with redirect and get urls', () => {
        component.partners = airlineCodes;
        component.ngOnChanges({ partners: new SimpleChange(null, airlineCodes, false) });

        expect(component.urls).toEqual(['https://www.flyaurora.ru', 'https://www.pobeda.aero']);
    });
});
