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

test: Add missing test for Parse.User.verifyPassword option ignoreEmailVerification #2103

Closed

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Apr 13, 2024

Pull Request

Issue

#2076 introduced a new feature for verifiying user passwords with a ignoreEmailVerification option. A unit test is missing.

Closes: #2101

Approach

Add test

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

Copy link

Thanks for opening this pull request!

@dplewis dplewis closed this Apr 13, 2024
@dplewis dplewis deleted the ignore-email-verification branch April 13, 2024 00:44
@dplewis dplewis restored the ignore-email-verification branch April 13, 2024 00:46
@dplewis dplewis reopened this Apr 13, 2024
@dplewis dplewis changed the title fix: Incorrecly use ignoreEmailVerification option on Parse.User.verifyPassword refactor: Add missing test for https://github.com/parse-community/Parse-SDK-JS/pull/2076 Apr 13, 2024
@dplewis dplewis changed the title refactor: Add missing test for https://github.com/parse-community/Parse-SDK-JS/pull/2076 refactor: Add missing test for Parse.User.verifyPassword option ignoreEmailVerification Apr 13, 2024
@dplewis dplewis requested a review from a team April 13, 2024 00:59
@dplewis
Copy link
Member Author

dplewis commented Apr 13, 2024

@mtrezza Looks like CodeCov is broken

{'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}

@dplewis dplewis changed the title refactor: Add missing test for Parse.User.verifyPassword option ignoreEmailVerification ci: Add missing test for Parse.User.verifyPassword option ignoreEmailVerification Apr 13, 2024
@mtrezza
Copy link
Member

mtrezza commented Apr 13, 2024

I assumed an integration test would cover the REST controller as well... why do we need to add a test for the REST controller?

@mtrezza mtrezza closed this Apr 13, 2024
@mtrezza mtrezza reopened this Apr 13, 2024
@dplewis
Copy link
Member Author

dplewis commented Apr 13, 2024

It was missing coverage https://app.codecov.io/gh/parse-community/Parse-SDK-JS/commit/b0adf7e02ab0beea2cd9b759d0f788c69d291491/blob/src/RESTController.js#L254

Also any particular reason why you added this options to the payload?

@mtrezza
Copy link
Member

mtrezza commented Apr 13, 2024

Looks like CodeCov is broken

Fixed in #2105

Copy link

codecov bot commented Apr 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (72bc9ac) to head (09f53f0).
Report is 2 commits behind head on alpha.

Additional details and impacted files
@@             Coverage Diff             @@
##            alpha     #2103      +/-   ##
===========================================
+ Coverage   99.98%   100.00%   +0.01%     
===========================================
  Files          61        61              
  Lines        6185      6185              
  Branches     1499      1499              
===========================================
+ Hits         6184      6185       +1     
+ Misses          1         0       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dplewis
Copy link
Member Author

dplewis commented Apr 13, 2024

@mtrezza Nice! Back to 100.00% coverage

@mtrezza
Copy link
Member

mtrezza commented Apr 13, 2024

Also any particular reason why you added this options to the payload?

Where do you suggest to put it?

@mtrezza mtrezza changed the title ci: Add missing test for Parse.User.verifyPassword option ignoreEmailVerification test: Add missing test for Parse.User.verifyPassword option ignoreEmailVerification Apr 13, 2024
@mtrezza mtrezza changed the title test: Add missing test for Parse.User.verifyPassword option ignoreEmailVerification test: Add missing test for Parse.User.verifyPassword option ignoreEmailVerification Apr 13, 2024
@dplewis
Copy link
Member Author

dplewis commented Apr 13, 2024

Just the placement seemed off. It should have been added to the data send which would have automatically added to the payload. In this case the test wouldn't have been needed.

https://github.com/parse-community/Parse-SDK-JS/blob/alpha/src/RESTController.js#L215-L220

@mtrezza
Copy link
Member

mtrezza commented Apr 13, 2024

I believe I've added it to the options arg because the method was already designed like that:

Parse-SDK-JS/src/ParseUser.js

Lines 1263 to 1266 in c591895

verifyPassword(username: string, password: string, options: RequestOptions) {
const RESTController = CoreManager.getRESTController();
return RESTController.request('GET', 'verifyPassword', { username, password }, options);
},

username and password are data, and ignoreEmailVerification is an option. Hence it looked odd to me to extract it from the option arg and move it to the data arg. I believe that's why I've decided to pass it through as is.

You think it should be changed?

@dplewis
Copy link
Member Author

dplewis commented Apr 13, 2024

I think it should change as you are still extracting it to the data payload in the RESTController. Would this work with directAccess on the server as the RESTController would change? Also there isn't any documentation for this field.

@dplewis dplewis closed this Apr 13, 2024
@dplewis dplewis deleted the ignore-email-verification branch April 13, 2024 15:32
@mtrezza
Copy link
Member

mtrezza commented Apr 13, 2024

Alright then I'll change this in another PR and add the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing test for Parse.User.verifyPassword option ignoreEmailVerification
2 participants