insertion sort in js and some tests