import { isSearchPath } from './isSearchPath'; // Adjust the import path accordingly

describe('isSearchPath', () => {
  it('should return true if pagePath is "s"', () => {
    const allMarkets = {};
    const pagePath = 's';

    const result = isSearchPath(allMarkets, pagePath);

    expect(result).toEqual(true);
  });

  it('should return true if pagePath matches any path prefix in allMarkets', () => {
    const allMarkets = {
      arab_ar: { path_prefix: 'ar', market: 'arab_ar' },
      arab_en: { path_prefix: null },
    };
    const pagePath = 'ar/s';

    const result = isSearchPath(allMarkets, pagePath);

    expect(result).toEqual(true);
  });

  it('should return false if pagePath does not match any path prefix in allMarkets', () => {
    const allMarkets = {
      arab_ar: { path_prefix: 'ar', market: 'arab_ar' },
      arab_en: { path_prefix: null },
    };
    const pagePath = 'en/s';

    const result = isSearchPath(allMarkets, pagePath);

    expect(result).toEqual(false);
  });

  it('should return false if allMarkets is null or empty', () => {
    const allMarkets = null;

    const result = isSearchPath(allMarkets);

    expect(result).toEqual(false);
  });

  it('should return false if pagePath is null or empty', () => {
    const allMarkets = {
      arab_ar: { path_prefix: 'ar', market: 'arab_ar' },
      arab_en: { path_prefix: null },
    };
    const pagePath = null;

    const result = isSearchPath(allMarkets, pagePath);

    expect(result).toEqual(false);
  });
});
