<commit_before>import { CaseType } from '../../models/caseType';
import { OdataQueryBuilderService } from '../odataQueryBuilder.service';
import {
  Column,
  ColumnFilter,
  ColumnSort,
  CurrentFilter,
  FilterChangedArgs,
  GridOption,
  MultiColumnSort,
  Pagination,
  ColumnFilters,
  OperatorType,
  FieldType,
  CurrentSorter,
  OdataOption,
} from '../../models';

const DEFAULT_ITEMS_PER_PAGE = 25;
const DEFAULT_PAGE_SIZE = 20;

const gridOptionMock = {
  enablePagination: true,
  backendServiceApi: {
    service: undefined,
    preProcess: jest.fn(),
    process: jest.fn(),
    postProcess: jest.fn(),
  }
} as GridOption;

const gridStub = {
  autosizeColumns: jest.fn(),
  getColumnIndex: jest.fn(),
  getScrollbarDimensions: jest.fn(),
  getOptions: () => gridOptionMock,
  getColumns: jest.fn(),
  setColumns: jest.fn(),
  registerPlugin: jest.fn(),
  setSelectedRows: jest.fn(),
  setSortColumns: jest.fn(),
};

describe('OdataService', () => {
  let service: OdataQueryBuilderService;

  beforeEach(() => {
    service = new OdataQueryBuilderService();
  });

  afterEach(() => {
    jest.clearAllMocks();
  });

  it('should create the service', () => {
    expect(service).toBeTruthy();
  });

  describe('buildQuery method', () => {
    beforeEach(() => {
      service.options = { filterQueue: [], orderBy: '' };
    });

    it('should throw an error when odata options are null', () => {
      service.options = undefined;
      expect(() => service.buildQuery()).toThrow();
    });

    it('should return a query with $top pagination', () => {
      const expectation = '$top=25';

      service.options = { top: 25 };
      const query = service.buildQuery();<commit_msg>refactor(test): removed unused imports in test<commit_after>import { CaseType } from '../../models/caseType';
import { OdataQueryBuilderService } from '../odataQueryBuilder.service';

describe('OdataService', () => {
  let service: OdataQueryBuilderService;

  beforeEach(() => {
    service = new OdataQueryBuilderService();
  });

  afterEach(() => {
    jest.clearAllMocks();
  });

  it('should create the service', () => {
    expect(service).toBeTruthy();
  });

  describe('buildQuery method', () => {
    beforeEach(() => {
      service.options = { filterQueue: [], orderBy: '' };
    });

    it('should throw an error when odata options are null', () => {
      service.options = undefined;
      expect(() => service.buildQuery()).toThrow();
    });

    it('should return a query with $top pagination', () => {
      const expectation = '$top=25';

      service.options = { top: 25 };
      const query = service.buildQuery();
{'fraction_non_alphanumeric': 0.16477272727272727, 'fraction_numerical': 0.004545454545454545, 'mean_word_length': 3.5145299145299145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6442231', 'n_tokens_mistral': 809, 'n_tokens_neox': 787, 'n_words': 177}