Improve tests to not depending on order returned by the DB