Skip to content

Conversation

oguzkocer
Copy link
Contributor

@oguzkocer oguzkocer commented May 2, 2024

For UserListParams unit tests, we use a macro to dynamically generate the test cases. This allows us to set arbitrary number of fields of UserListParams and validate them against given query pairs. For now, the macro lives in the tests module, but I think we might move this into the library in a future PR as it would be useful in other places as well.

I realized that there was a missing s in UserListParams. has_published_posts field as I was working on the unit tests, so this PR also fixes that.

Note that other parameter types don't have query_pairs function - or any other function for that matter - so they don't get any unit tests.

Quick tip:

If you run the tests with --nocapture option, for example as cargo test --lib -- --nocapture, you can see all the test cases for the test_user_list_params in the logs. I'll go ahead and set this option for CI, so it's visible in CI logs as well. e409d6a

@oguzkocer oguzkocer added this to the 0.1 milestone May 2, 2024
@oguzkocer oguzkocer requested review from crazytonyli and jkmassel May 2, 2024 20:06
@oguzkocer oguzkocer merged commit 9dec8cd into trunk May 2, 2024
@oguzkocer oguzkocer deleted the users_params_tests branch May 2, 2024 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants