Skip to content

Fix incorrect output ordering in tests in some cases#1825

Merged
ricardograca merged 3 commits into
masterfrom
rg-fix-tests
Apr 24, 2018
Merged

Fix incorrect output ordering in tests in some cases#1825
ricardograca merged 3 commits into
masterfrom
rg-fix-tests

Conversation

@ricardograca

@ricardograca ricardograca commented Apr 23, 2018

Copy link
Copy Markdown
Member

Introduction

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

Motivation

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 merged commit ae11cca into master 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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant