import { describe, expect, it } from "vitest";
import { createRequire } from "module";

const require = createRequire(import.meta.url);
const { JOB_DOCUMENT_FIELDS, BASE_GLOBAL_SEARCH_QUERY_STRING_FIELDS, getGlobalSearchQueryStringFields } = require(
  "../os-search-config"
);

describe("os-search-config", () => {
  it("indexes dms_id on job documents", () => {
    expect(JOB_DOCUMENT_FIELDS).toContain("dms_id");
  });

  it("includes dms_id in global search fields for Reynolds shops", () => {
    expect(getGlobalSearchQueryStringFields({ isReynoldsEnabled: true })).toContain("*dms_id^20");
  });

  it("keeps the default search fields unchanged for non-Reynolds shops", () => {
    expect(getGlobalSearchQueryStringFields()).toEqual(BASE_GLOBAL_SEARCH_QUERY_STRING_FIELDS);
  });
});
