import { ApplicationState } from './application.state';
import { ApplicationProcess } from '../defs';
import * as selectors from './application.selectors';

describe('applicationSelectors', () => {
  it('should select the processes', () => {
    const processes: ApplicationProcess[] = [{ id: 1, name: 'Vorgang 1', section: 'customer' }];
    const state: Partial<ApplicationState> = {
      processes,
    };
    expect(selectors.selectProcesses.projector(state)).toEqual(processes);
  });

  it('should select the section', () => {
    const state: Partial<ApplicationState> = {
      section: 'customer',
    };
    expect(selectors.selectSection.projector(state)).toEqual('customer');
  });

  it('should select the activatedProcess', () => {
    const processes: ApplicationProcess[] = [
      { id: 1, name: 'Vorgang 1', section: 'customer', activated: 100 },
      { id: 2, name: 'Vorgang 2', section: 'customer', activated: 300 },
      { id: 3, name: 'Vorgang 3', section: 'customer', activated: 200 },
    ];
    const state: Partial<ApplicationState> = {
      processes,
    };
    expect(selectors.selectActivatedProcess.projector(state)).toEqual(processes[1]);
  });
});
