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;
}

test("sort", function (assert) {
    assert.forAll(function(list) {
        var orig = list.slice();
        sort(list);
        return orig.length === list.length;
    }, qc.arrayOf(qc.int));
});