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

Tests: improve coverage #156

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Tests: improve coverage #156

wants to merge 12 commits into from

Conversation

jankapunkt
Copy link
Member

Summary

in order to make big changes/improvements/fixes without regression we need better test coverage ☔

NOTE!

By writing the tests there were mutliple issues that have been detected and commented accordingly, they are attempted to be non-breaking. Please consider once you review the PR.

Also note this PR is draft-mode until we reach >= 90% coverage!

Linked issue(s)

#152

Involved parts of the project

all

Added tests?

a lot

Targeted Meteor release version

2.x yet

Reproduction

run tests

@jankapunkt jankapunkt linked an issue Apr 17, 2024 that may be closed by this pull request
Copy link

Closing this PR due to no activity. Feel free to reopen.

@jankapunkt jankapunkt marked this pull request as ready for review July 16, 2024 11:49
test/src/User.tests.js Dismissed Show dismissed Hide dismissed
Copy link
Collaborator

@bratelefant bratelefant left a comment

Choose a reason for hiding this comment

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

Thanks for the additional tests and cleanup!

}

if (!newPassword) {
return callback(new Error('Password may not be empty'));
}

call(
'changePassword',
oldPassword ? hashPassword(oldPassword) : null,
hashPassword(newPassword),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it really hashed here? Had a look at Meteors password_server.js, looks like the newPassword is hashed on the server side

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok got it, it sending the object with the sha256 hash, not the string.

@@ -90,8 +98,16 @@ class AccountsPassword {
* @param callback {function(e:Error)=} optional callback that is invoked with one optional error argument
*/
resetPassword = (token, newPassword, callback = () => {}) => {
if (!(typeof token === 'string' || token instanceof String)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the type checking different from e.g the createUser function here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

General question on the restoreAll function; can't we simply do sinon.restore() here?

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.

Still need more test coverage
2 participants