describe('Inverted Index Tests', function() {
  var invertedIndex = new Index();
  var sourceFile = './books.json';

  beforeEach(function(done) {
    invertedIndex.createIndex('', function() {
      done();
    });
  });

  describe('Read book data', function() {
    it('asserts that json file is not empty', function() {
      expect(invertedIndex.content).not.toEqual([]);
    });
  });

  describe('Populate index', function() {
    it('verifies that the index is created once the JSON file has been read', function() {
      expect(invertedIndex.readIndex).toBeDefined();
      expect(invertedIndex.readIndex.length).not.toBe(null);
    });

    it('index maps the string keys to the correct objects in the JSON array', function() {
      expect(invertedIndex.index.alice).toEqual([1, 0, 0]);
      expect(invertedIndex.index.ring).toEqual([0, 0, 1]);
    });
  });
  describe('Search Index', function() {
    it('verifies that searching the index returns an array of the indices of the correct objects', function() {
      expect(invertedIndex.searchIndex('alice').alice).toEqual([0]);
      expect(invertedIndex.searchIndex('rings').ring).toEqual([1]);
    });
  });
});

@@ -108,16 +108,32 @@
 s.json';
+%0A  var filePath;
 %0A%0A  befo
@@ -190,24 +190,172 @@
 dex(
-'', function() %7B
+sourceFile).done(function(data) %7B%0A      invertedIndex.parsedJSON = data;%0A      filePath = invertedIndex.getFile(sourceFile);%0A%0A      //invoke jasmine's done callback
 %0A   
@@ -949,15 +949,8 @@
 al(%5B
-1, 0, 0
 %5D);%0A
@@ -1001,15 +1001,8 @@
 al(%5B
-0, 0, 1
 %5D);%0A
@@ -1235,9 +1235,8 @@
 al(%5B
-0
 %5D);%0A
@@ -1302,9 +1302,8 @@
 al(%5B
-1
 %5D);%0A

modify the indexes