import { ShowScanButtonPipe } from './show-scan-button.pipe';

fdescribe('#ShowScanButtonPipe', () => {
  let pipe: ShowScanButtonPipe;

  let isIpad: boolean;
  let searchQuery: string;
  let errorMessage: string;

  beforeEach(() => {
    pipe = new ShowScanButtonPipe();
  });

  it('it should not be shown on desktop', () => {
    isIpad = false;
    searchQuery = '';
    errorMessage = '';

    const result = pipe.transform(isIpad, searchQuery, errorMessage);
    expect(result).toBe(false);
  });

  it('it should shown on iPad if no input is yet made and no error is present', () => {
    isIpad = true;
    searchQuery = '';
    errorMessage = '';

    const result = pipe.transform(isIpad, searchQuery, errorMessage);
    expect(result).toBe(true);
  });

  it('it should not be shown on iPad if an input is made', () => {
    isIpad = true;
    searchQuery = 'Testkunde';
    errorMessage = '';

    const result = pipe.transform(isIpad, searchQuery, errorMessage);
    expect(result).toBe(false);
  });

  it('it should not be shown on iPad if an input is made', () => {
    isIpad = true;
    searchQuery = '';
    errorMessage = 'Unbekannter Fehler';

    const result = pipe.transform(isIpad, searchQuery, errorMessage);
    expect(result).toBe(false);
  });
});
