Skip to content

Conversation

@RohitGarudadri
Copy link
Contributor

@RohitGarudadri RohitGarudadri commented Dec 21, 2019

Tickets:

HCK-194, 176

List of changes:

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

  • Removed all instances of 'needsBus' from backend, as well as added tests for the travel field.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Added a new test in the hacker.test.js

Questions for code reviewers?

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Listed change(s) in the Changelog
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

})
.withMessage(
`${fieldname} must be between ${lowerBound} and ${upperBound}`
`${fieldname} must be between ${lowerBound} and ${upperBound}`
Copy link
Member

Choose a reason for hiding this comment

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

does this only validate that travel is an integer? or does it also cover the [0,100] inclusive bound?

Copy link
Contributor Author

@RohitGarudadri RohitGarudadri Dec 22, 2019

Choose a reason for hiding this comment

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

I made a new test all together that also validates the 0-100 bound

Copy link
Member

Choose a reason for hiding this comment

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

does it validate float vs int? or is that being done on front end?

Copy link
Member

Choose a reason for hiding this comment

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

@Ty-Won that would be a frontend validation, I'll have a PR for that tn 😉

Copy link
Member

Choose a reason for hiding this comment

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

If we want to stay properly RESTful the int validation should be on the API

Copy link
Member

Choose a reason for hiding this comment

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

Agreed we should have api validation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The validator does check .isInt() which seems to work. If I input a float, like 10.5 for travel, then indeed the error appears saying that it should be an integer. Do we need more than this?

Copy link
Member

Choose a reason for hiding this comment

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

Seems good to me, I also added int validation on the frontend: hackmcgill/dashboard#764

};

// duplicate of newHack0, but with 101 for travel
const invalidHacker2 = {
Copy link
Member

Choose a reason for hiding this comment

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

are we missing tests for impairments and barriers? I'll make a ticket if we are

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there are no tests for those currently.

@loreina loreina requested a review from Ty-Won December 22, 2019 16:39
@RohitGarudadri RohitGarudadri merged commit 05c8cab into develop Dec 24, 2019
@RohitGarudadri RohitGarudadri deleted the feature/194-remove-needsBus branch December 24, 2019 04:14
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.

6 participants