Adding tests for foreign key traversal function