import { querySettingsData } from '../testing';
import { UiFilter } from './ui-filter';
import { UiInputGroup } from './ui-input-group';
import { UiOrderBy } from './ui-order-by';

describe('UiFilter', () => {
  const testData = querySettingsData;

  let uiFilter: UiFilter;

  beforeEach(() => {
    spyOn(UiInputGroup, 'create');
    spyOn(UiOrderBy, 'create');
    uiFilter = UiFilter.create(testData);
  });

  describe('static create(inputOptions: IUiQuerySettingsDTO)', () => {
    it('should return an instance of UiInputDTO', () => {
      expect(uiFilter instanceof UiFilter).toBe(true);
      testData.filter.forEach((filter) => expect(UiInputGroup.create).toHaveBeenCalled());
      testData.input.forEach((input) => expect(UiInputGroup.create).toHaveBeenCalled());
      testData.orderBy.forEach((orderBy) => expect(UiOrderBy.create).toHaveBeenCalled());
    });
  });
});
