test(core): add more tests for validator and clean up validator code