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

Creating unit testing for public methods #11

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

AnthonyGriffith
Copy link
Contributor

Description

  • Fixed a small bug in the library related with getting the opposite of what was expected in the isFieldValid method.
  • Created the tests for every public method of the library

Results

image

the function was returning the opposite of what was intended
@@ -461,7 +461,7 @@ export class Validation implements FormValidation {

if (!this.fieldsToValidate.includes(field)) throw new Error(`Field "${field.name}" is not being validated`);

return !!this.validateField(field, silently);
return !!!this.validateField(field, silently);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this can be: !this.validateField(field, silently);

Copy link
Contributor

@alsoto25 alsoto25 left a comment

Choose a reason for hiding this comment

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

Excellent job with the tests, super well written and easy to understand what is being tested!

LGTM after Brian's suggestion

@alsoto25 alsoto25 mentioned this pull request Sep 12, 2024
Copy link
Collaborator

@Brian06 Brian06 left a comment

Choose a reason for hiding this comment

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

nice job

@alsoto25 alsoto25 merged commit 643c385 into ltvco:main Sep 13, 2024
3 checks passed
alsoto25 added a commit to alsoto25/form-validation-ltv-public that referenced this pull request Oct 29, 2024
commit f640879
Author: Brian Salazar <bsalazarsanchez06@gmail.com>
Date:   Tue Oct 22 10:32:50 2024 -0600

    [SWAT-4099][Form Validation Open Source] Fix in isFieldValid (ltvco#16)

    * fix to send the correct value

    * 1.0.2

    ---------

    Co-authored-by: Brian Salazar <briansalazar@Brians-MacBook-Pro.local>

commit 4d02934
Author: Brian Salazar <bsalazarsanchez06@gmail.com>
Date:   Tue Oct 22 09:19:29 2024 -0600

    [SWAT-4097] Remove all test related code (ltvco#15)

    * remove all test related code

    * remove the fix to apply it in a separate PR

    ---------

    Co-authored-by: Brian Salazar <briansalazar@Brians-MacBook-Pro.local>

commit a51dfbe
Author: Md Mohsin <77264192+Emkay2309@users.noreply.github.com>
Date:   Tue Oct 15 19:43:24 2024 +0530

    Added pull_request_template and created  issue templates for bug reports and feature_requests  (ltvco#12)

commit 643c385
Merge: 4ffcce2 7015f93
Author: Ale Soto <37157321+alsoto25@users.noreply.github.com>
Date:   Fri Sep 13 12:47:24 2024 -0600

    Merge pull request ltvco#11 from AnthonyGriffith/ag_public-methods-tests

commit 7015f93
Author: Anthony Griffith <agriffith@ltvco.com>
Date:   Wed Sep 11 11:42:20 2024 -0600

    add tests to all methods

commit 282d18c
Author: Anthony Griffith <agriffith@ltvco.com>
Date:   Wed Sep 11 11:40:50 2024 -0600

    fix method return

    the function was returning the opposite of what was intended

commit 4ffcce2
Merge: edbc384 157f604
Author: Ale Soto <37157321+alsoto25@users.noreply.github.com>
Date:   Wed Jul 31 09:55:47 2024 -0600

    Merge pull request ltvco#9 from alsoto25/main
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.

4 participants