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: A bug fix, issue 266 #284

Merged

Conversation

jomendez
Copy link
Contributor

Description:
Store the fields that have been ordered by with (and throw if you try to
orderBy twice in the same field) instead of just checking if any fields
have been ordered by.
An orderBy function cannot be called more than once in the same query
expression, except in different fields.

Fixing issue #266

Description:
Store the fields that have been ordered by with (and throw if you try to
orderBy twice in the same field) instead of just checking if any fields
have been ordered by.
An orderBy function cannot be called more than once in the same query
expression, except on different fields.

Fixing issue wovalle#266
@codecov
Copy link

codecov bot commented Nov 11, 2021

Codecov Report

Merging #284 (f94aa04) into master (10d78dd) will increase coverage by 0.20%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #284      +/-   ##
==========================================
+ Coverage   95.46%   95.67%   +0.20%     
==========================================
  Files          26       26              
  Lines         662      671       +9     
  Branches      108      112       +4     
==========================================
+ Hits          632      642      +10     
+ Misses         29       28       -1     
  Partials        1        1              
Impacted Files Coverage Δ
src/QueryBuilder.ts 98.73% <100.00%> (+1.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 10d78dd...f94aa04. Read the comment docs.

const albumsSubColl = pt.albums;
expect(() => {
albumsSubColl.orderByAscending('releaseDate').orderByDescending('name');
}).toBeTruthy();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you assert that calling orderBy* methods not.toThrow() instead of toBeTruthy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense!
done

Copy link
Owner

@wovalle wovalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! Just two tiny comments and we can merge this one.

Thanks for the contribution!

const albumsSubColl = pt.albums;
expect(() => {
albumsSubColl.orderByAscending('releaseDate').orderByDescending('name');
}).toBeTruthy();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const albumsSubColl = pt.albums;
expect(() => {
albumsSubColl.orderByAscending('releaseDate').orderByDescending('name');
}).toBeTruthy();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add two tests where you call the same orderBy method twice with different fields, such as:

expect(() => {
  albumsSubColl.orderByAscending('releaseDate').orderByAscending('name');
}).not.toThrow();
expect(() => {
  albumsSubColl. orderByDescending('releaseDate'). orderByDescending('name');
}).not.toThrow();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Owner

@wovalle wovalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great Job!

@wovalle wovalle merged commit 3732cf1 into wovalle:master Nov 11, 2021
@wovalle
Copy link
Owner

wovalle commented Nov 11, 2021

@all-contributors please add @jomendez for code

@allcontributors
Copy link
Contributor

@wovalle

I've put up a pull request to add @jomendez! 🎉

@whateverbot
Copy link
Collaborator

🎉 This PR is included in version 0.23.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

3 participants