import * as SearchSelectors from './search.selectors';
import { SearchState, SearchProcessState } from '@shelf-store';

fdescribe('Search State Selectors', () => {
  let state: SearchState;

  beforeEach(() => {
    state = {
      ids: [123, 456],
      entities: {
        123: {
          id: 123,
          pendingInput: 'Test',
          result: [],
          state: SearchProcessState.FETCHED,
        },
        456: {
          id: 456,
          pendingInput: '',
          result: [],
          state: SearchProcessState.INIT,
        },
      },
    };
  });

  describe('selectPendingInput', () => {
    it('should select the pending input for the provided processId', () => {
      const id = 123;
      const result = SearchSelectors.selectPendingInput.projector(state.entities, id);

      expect(result).toEqual(state.entities[id].pendingInput);
    });
  });
});
