This PR resolves #14
The testing system needed to be improved and revamped, so it can be table driven to allow for descriptive tailored test cases for each function of the database.
Usage
N/A
Changes
Non-trivial Files
Code coverage for mysql.go is now from approx. 55% to 65.9%. The remaining percentage is due to error checks that do not need to be tested.
mysql_test.go was changed to add table driven unit tests to the AddUser(), GetUser(), GetUserID(). Additionally, minor refactoring was performed for code consistency and creating streamlined production code.
Added a hot fix to mysql.go, the fix was to quickly implement empty strings validation for username, email, passwords.
Testing
[x] ➕ Added units to existing tests
[ ] 🐣 Started a new group of tests
[ ] 🙅 New tests aren't needed
[ ] 🙋 Need help to add tests
Dependencies
N/A
Documentation Changes
[ ] 📜 README.md
[ ] 💬 Added necessary comments to existing code
[ ] 📕 storybook
[x] 🙅 no documentation needed
Issues and Bugs
Found out there is no validation or error checking on the backend for if a user enters an empty string for username, email, password.
Additionally, there needs to be functionality to check whether the email added is valid.
Possible Solutions
Future development will have the variables passed into the function already validated. This kind of validation is not in the scope of this PR, and will require another issue ticket to be opened to be resolved.
Additional Notes
Small concern that while adding table driven unit tests, the code base does increase quite a bit and some Test functions may not require this level of complexity to execute the test cases. Table driven tests may unnecessarily complex for the test cases.
For other notes refer to the Issues and Bugs Section of this PR.
Rationale
This PR resolves #14
The testing system needed to be improved and revamped, so it can be table driven to allow for descriptive tailored test cases for each function of the database.
Usage
N/A
Changes
Non-trivial Files
Code coverage for mysql.go is now from approx. 55% to 65.9%. The remaining percentage is due to error checks that do not need to be tested.
Testing
Dependencies
N/A
Documentation Changes
Issues and Bugs
Possible Solutions
Future development will have the variables passed into the function already validated. This kind of validation is not in the scope of this PR, and will require another issue ticket to be opened to be resolved.
Additional Notes
Small concern that while adding table driven unit tests, the code base does increase quite a bit and some Test functions may not require this level of complexity to execute the test cases. Table driven tests may unnecessarily complex for the test cases. For other notes refer to the Issues and Bugs Section of this PR.