refactor(core): Reduce boilterplate code in between tests also cleaned up some imports, and fixed the tests in node.js 20