Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect output ordering in tests in some cases #1825

merged 3 commits into from Apr 24, 2018


Copy link

@ricardograca ricardograca commented Apr 23, 2018


This ensures that output from database tests are ordered by model id.


Some tests require that the output is exactly the same as some predefined values. However, the previous PR mentioned above introduced a change that caused output ordering to be changed on PostgreSQL, even though the data is exactly the same.

There shouldn't be any need to check for ordering of results unless that is the intended purpose of a specific test.

Fixes #426.

Proposed solution

This just orders models inside collections by id after they are fetched from the database. This application side approach was chosen to avoid changing all the affected tests.

- This ensures that the order of results returned by the database
doesn't affect tests that are comparing them to pre-defined values with
a certain order.
@ricardograca ricardograca added this to To Do in Version 0.14.0 via automation Apr 23, 2018
@ricardograca ricardograca moved this from To Do to In progress in Version 0.14.0 Apr 23, 2018
@ricardograca ricardograca merged commit ae11cca into master Apr 24, 2018
Version 0.14.0 automation moved this from In progress to Done Apr 24, 2018
@ricardograca ricardograca deleted the rg-fix-tests branch April 24, 2018 10:22
MonkeyDo added a commit to metabrainz/bookbrainz-data-js that referenced this pull request Oct 25, 2019
In tests mostly but also for author credits.
See bookshelf/bookshelf#1825
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No open projects

Successfully merging this pull request may close these issues.

None yet

1 participant