import { querySettingsData } from '../testing';
import { Filter } from './filter';
import { InputGroup } from './input-group';
import { OrderBy } from './order-by';

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

  let uiFilter: Filter;

  beforeEach(() => {
    spyOn(InputGroup, 'create');
    spyOn(OrderBy, 'create');
    uiFilter = Filter.create(testData);
  });

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