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

describe('UiInputGroupSelectorPipe', () => {
  let spectator: SpectatorPipe<UiInputGroupSelectorPipe>;
  const createPipe = createPipeFactory(UiInputGroupSelectorPipe);
  const inputGroups: IUiInputGroup[] = [{ 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');
  });
});
