Add a test for query chaining

It turns out that we don't actually have any, and unsurprisingly it doesn't work (see #927). The actual bug appears to be in the core, but even once that's fixed we need a test verifying it works in the binding.