Fix precondition in `validate-order-by!`
Add tests for `order-by`