import { TestBed } from '@angular/core/testing';
import { AppSettingsService } from '.';
import { AppSettings } from '../models-legacy';

import { SettingsResolver } from './settings.resolver';

describe('SettingsResolver', () => {
    let resolver: SettingsResolver;
    const settings: AppSettings = {} as any;
    const service: AppSettingsService = {
        getSettings: jasmine.createSpy('getSettings').and.returnValue(Promise.resolve(settings)),
    } as any;

    beforeEach(() => {
        TestBed.configureTestingModule({
            providers: [
                {
                    provide: AppSettingsService,
                    useValue: service,
                },
            ],
        });
        resolver = TestBed.inject(SettingsResolver);
    });

    it('should be created', () => {
        expect(resolver).toBeTruthy();
    });

    it('should resolve settings', async () => {
        expect(await resolver.resolve()).toBe(settings);
    });
});
