import { createPipeFactory, SpectatorPipe } from '@ngneat/spectator';
import { IInputGroup } from '../tree';
import { InputGroupSelectorPipe } from './input-group-selector.pipe';

describe('InputGroupSelectorPipe', () => {
  let spectator: SpectatorPipe<InputGroupSelectorPipe>;
  const createPipe = createPipeFactory(InputGroupSelectorPipe);
  const inputGroups: IInputGroup[] = [{ group: 'group1' }, { group: 'group2' }, { group: 'group3' }];

  it('should return the IUiInputGroup with group to be unittest', () => {
    spectator = createPipe(`{{ (value | group:group)?.group }}`, {
      hostProps: { value: inputGroups, group: 'group2' },
    });

    expect(spectator.element).toHaveText('group2');
  });
});
