Add test for query functions