/*import { CursorPaging } from "../CursorPaging";*/
import { OffsetPaging } from "../OffsetPaging";

describe.skip('OffsetPaging', () => {
  beforeAll(() => { });

  beforeEach(() => { });

  test('comprobar que se crea correctamente', () => {
    const offset: number = 0;
    const limit: number = 15;

    const offsetPaging = OffsetPaging.create(offset, limit);

    expect(offsetPaging.start).toEqual(offset);
    expect(offsetPaging.limit).toEqual(limit);
  });

  test('comprobar que se calcula la siguiente página correctamente', () => {
    const offset: number = 0;
    const limit: number = 15;
    const nextStart: number = offset + limit;

    const nextPaging = OffsetPaging.create(offset, limit).next();
    expect(nextPaging.start).toEqual(nextStart);
  });

  test('comprobar que el offset es obligatorio', () => {
    const offset: number = undefined;

    try {
      const offsetPaging = OffsetPaging.create(offset, 10);
    } catch (error) {
      expect(error).toBeInstanceOf(EvalError);
    }
  });

  test('comprobar que el offset >= 0', () => {
    const offset: number = -1;

    try {
      const offsetPaging = OffsetPaging.create(offset, 100);
    } catch (error) {
      expect(error).toBeInstanceOf(RangeError);
    }
  });

  test('comprobar que el offset <= MAXIMAL_LIMIT', () => {
    const offset: number = 0;
    const excedeMaximo: number = OffsetPaging.LIMIT_MAXIMAL_VALUE + 1;

    try {
      const offsetPaging = OffsetPaging.create(offset, excedeMaximo);
    } catch (error) {
      expect(error).toBeInstanceOf(RangeError);
    }
  });
});

describe.skip('CursorPaging', () => {
  beforeAll(() => { });

  beforeEach(() => { });

  test('comprobar que se crea correctamente', () => {
    const cursor: string = 'cursor';
    const limit: number = 10;

    const cursorPaging = CursorPaging.create(cursor, limit);

    expect(cursorPaging.start).toEqual(cursor);
    expect(cursorPaging.limit).toEqual(limit);
  });

  test('comprobar que el cursor es obligatorio', () => {
    const cursor: string = undefined;

    try {
      const cursorPaging = CursorPaging.create(cursor, 10);
    } catch (error) {
      expect(error).toBeInstanceOf(EvalError);
    }
  });
});