import { SpectatorPipe, createPipeFactory } from '@ngneat/spectator';
import { ProcessingStatusPipe } from './processing-status.pipe';

describe('ProcessingStatusPipe', () => {
  let spectator: SpectatorPipe<ProcessingStatusPipe>;
  const createPipe = createPipeFactory(ProcessingStatusPipe);

  it('should return icon name (close) if type is icon', () => {
    spectator = createPipe(`{{ 1024 | processingStatus:'icon' }}`);
    expect(spectator.element).toHaveText('close');
  });

  it('should return the status name for status 1024 (storniert)', () => {
    spectator = createPipe(`{{ 1024 | processingStatus }}`);
    expect(spectator.element).toHaveText('storniert');
  });

  it('should return an empty string if the status code is not found', () => {
    spectator = createPipe(`{{ 17 | processingStatus }}`);
    expect(spectator.element).toHaveText('');
  });

  it('should return an empty string if the status code is not found and type is icon', () => {
    spectator = createPipe(`{{ 17 | processingStatus:'icon' }}`);
    expect(spectator.element).toHaveText('');
  });
});
