import { IInputOptions, InputOptions } from './input-options';
import { Option } from './option';

describe('InputOptions', () => {
  const testData: IInputOptions = {
    max: 2,
    values: [
      { label: 'abgeholt', value: '256' },
      { label: 'angefragt', value: '524288' },
      { label: 'ans Lager (nicht abgeholt)', value: '262144' },
      { label: 'bestellt', value: '16', selected: true },
    ],
  };

  let inputOptions: InputOptions;

  beforeEach(() => {
    spyOn(Option, 'create');
    inputOptions = InputOptions.create(testData);
  });

  describe('static create(inputOptions: IUiInputOptions)', () => {
    it('should return an instance of IUiInputOptions', () => {
      expect(inputOptions instanceof InputOptions).toBe(true);
      expect(inputOptions.max).toBe(testData.max);
      testData.values.forEach((value) => expect(Option.create).toHaveBeenCalledWith(value, inputOptions));
    });
  });
});
