Improve tree node comparison tests.

Use and improve common node equality tester.
Fix problems (uncovered from using the better tester) with existing hierarchy tree builder tests.

Bug: b/311643292
Test: npm run test:unit:ci

Change-Id: Iec43622a06e6ecad8f8ee3586253bf4937168185
6 files changed