engine: adding unit tests for isLeader