Added tests for isAncestor utility function