var assert = require('assert');

describe('Question set', function () {
  let QuestionSet = require('../src/QuestionSet');
  let questions;

  beforeEach(function () {
    questions = new QuestionSet();
  });

  it('can be chained', function() {
    assert.equal(questions, questions.select());
    assert.equal(questions, questions.noanswers);
  });
  it('#array returns valid question objects', function() {
    questions.array.forEach((question) => {
      assert.notEqual(question.text, undefined);
      assert.notEqual(question.answer, undefined);
      assert.notEqual(question.choice_a, undefined);
    });
  });
  it('#select(10).array returns a 10 element array', function() {
    assert.equal(questions.select(10).array.length, 10);
  });
  it('#select(0).array returns an empty array', function() {
    let result = questions.select(0).array;

    assert.equal(result.constructor, Array);
    assert.equal(result.length, 0);
  });
  it('#select(1000).array returns all questions', function() {
    let length = questions.array.length;

    assert.equal(questions.select(1000).array.length, length);
  });
  it('#noanswers leaves no answer properties', function() {
    let result = questions.noanswers.array;

    for (var i in result) {
      assert.equal(result[i].answer, undefined);
    }
  });
});

@@ -606,32 +606,206 @@
 ;%0A    %7D);%0A  %7D);%0A
+  it('#select(1000).array returns all questions', function() %7B%0A    let length = questions.array.length;%0A%0A    assert.equal(questions.select(1000).array.length, length);%0A  %7D);%0A
   it('#select(10
@@ -927,25 +927,25 @@
 it('#select(
-0
+i
 ).array retu
@@ -958,24 +958,35 @@
  empty array
+ for i %3C= 0
 ', function(
@@ -1119,164 +1119,119 @@
 0);%0A
+%0A
   
-%7D);%0A  it('#select(1000).array returns all questions', function() %7B%0A    let length = questions.array.length;%0A%0A    assert.equal(questions.select(1000).array
+  result = questions.select(-1).array;%0A%0A    assert.equal(result.constructor, Array);%0A    assert.equal(result
 .len
@@ -1227,38 +1227,33 @@
 (result.length, 
-length
+0
 );%0A  %7D);%0A  it('#

Improve test coverage