text: const expect = require('chai').expect;
  const { Index, binaryInsert, binarySearch } = require("../../lib/table/index");
  
  const MockReader = require('./utils').MockReader;
  
  describe('Index', function() {
      describe('#binaryInsert()', function() {
          it('inserts numbers correctly', function() {
              let setup = new MockReader([{ id: 0 }, { id: 1 }, { id: 2 }]);
              expect(binaryInsert(1n, [0n, 2n], setup, "id")).to.deep.equal([0n, 1n, 2n]);
          });
  
          it('inserts duplicates correctly', function() {
              let setup = new MockReader([{ id: 0 }, { id: 1 }, { id: 2 }, { id: 2 }]);
              expect(binaryInsert(3n, [0n, 1n, 2n], setup, "id")).to.deep.equal([0n, 1n, 3n, 2n]);
          });
      });
  
      describe('#binarySearch()', function() {
          it('finds proper insertion point using numbers', function() {
              expect(binarySearch(4, [1, 2, 3, 5, 6], 0, 4)).to.equal(3);
          });
  
          it('finds proper insertion point using strings', function() {
              expect(binarySearch("D", ["A", "C", "F", "G"], 0, 3)).to.equal(2);
          });
  
          it('finds proper insertion point using big ints', function() {
              expect(binarySearch(BigInt(1000),
                  [BigInt(200), BigInt(300), BigInt(4000), BigInt(10000)],
                  0, 3))
                  .to.equal(2);
          });
  
          it('finds proper insertion point on an empty array', function() {
              expect(binarySearch(1, [], 0, 0)).to.equal(0);
          });
      });
  });