Improved insertBefore unit test