import { TestBed } from '@angular/core/testing';
import { IBreadCrumbItem } from '@components/page/breadcrumds/page-breadcrumbs.component';
import { ScheduleSearchBreadCrumbsResolver } from '@schedule/resolvers/bread-crumbs/search-bread-crumbs.resolver';
import { ScheduleBreadCrumbService } from '@schedule/services/bread-crumb.service';

describe('ScheduleSearchBreadCrumbsResolver', () => {
    let service: ScheduleSearchBreadCrumbsResolver;
    const getRootBreadCrumbMock = jasmine.createSpy('getRootBreadCrumb');
    const rootBreadCrumb: IBreadCrumbItem = {
        label: 'root-breadcrumb-label',
        url: 'root-breadcrumb-url',
    };
    beforeEach(() => {
        TestBed.configureTestingModule({
            providers: [
                ScheduleSearchBreadCrumbsResolver,
                {
                    provide: ScheduleBreadCrumbService,
                    useValue: {
                        getRootBreadCrumb: getRootBreadCrumbMock,
                    },
                },
            ],
        });

        service = TestBed.inject(ScheduleSearchBreadCrumbsResolver);

        getRootBreadCrumbMock.calls.reset();
        getRootBreadCrumbMock.withArgs().and.returnValue(rootBreadCrumb);
    });

    it('should return array with root breadcrumb item', () => {
        expect(service.resolve()).toEqual([rootBreadCrumb]);
    });
});
