Edit in JSFiddle

function sort(list) {
  for (var j = 1; j < list.length; j++) {
    var key = list[j],
        i = j - 1;
    while (i >= 0 && list[i] > key) {
      list[i + 1] = list[i];
      i--;
    }
    list[i + 1] = key;
  }
  return list;
}

describe('sort', function() {
  it('sorted lists have the same length as originals', function() {
    expect(function(list) { 
        var orig = list.slice();
        sort(list);
        return orig.length === list.length; 
    }).forAll(qc.arrayOf(qc.int));
  });
  
});