Testing Filters
I'm writing a function that dynamically adds filters to an Ash.Query for AshBackpex. I'm not sure how to assert that I'm getting the filters back that I want.
I can't figure out how to assert against this structure:
I can do this:
And I get:
contains(title, "foo bar")
But I don't know how to pattern match or make assertions against that.
I can also use Ash.Filter.to_simple_filter(...) and assert against the length filter.predicates , which might actually be enough for this use case. But I'd like to get more specific if possible.1 Reply
I think I got it!
Macro.escape!!!!!
Ah I see instead of to_simple_filter I can also use Ash.Filter.list_predicates(query.filter)
Helper function:
There's probably a more elegant way to do this using the Access module but I'm ok with it as is