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

ISSUE-10: Add unit tests #17

Merged
merged 27 commits into from
Jun 24, 2019
Merged

ISSUE-10: Add unit tests #17

merged 27 commits into from
Jun 24, 2019

Conversation

fraenky8
Copy link
Owner

@fraenky8 fraenky8 commented Apr 21, 2019

This PR fixes #10 and does the following:

  • Refactor the packages to use DI and therefore enable proper unit testing
  • Add unit tests for the Run() function for every supprted database and its datatypes:
    • String/Text data type
    • Integer data type
    • Float data type
    • Temporal data type
    • Special data types like booleans
  • Add unit tests for all other files including
    • databases:
      • mysql
      • postgresql
    • outpts:
      • decorator
      • writer
    • tagger:
      • db (covered by standard Run() function)
      • mastermind
      • [ ] sql
    • settings
  • Add units test for error cases
  • Increase overall test coverage
  • Add Scrutinizer support

Use DI to make use of best practices and to enable unit testing.
Inject a writer into the Run() function.
Therefore the constructor does not two things. The Connect() has to be
called explicit now.
The unit test checks for every database its supported string/text column
data types if the output produced by the Run() function is correct.
The unit test checks for every database its supported integer column
data types if the output produced by the Run() function is correct.
The unit test checks for every database its supported float column
data types if the output produced by the Run() function is correct.
The unit test checks for every database its supported temporal column
data types if the output produced by the Run() function is correct.

While writing these tests a bug came up which made it impossible to use
a primitive/builtin time.Time and a database specific time column type
at the same time. Fixed that with collecting information about the columns
in the columnInfo struct.
@fraenky8 fraenky8 self-assigned this Apr 21, 2019
The unit test checks for every database its supported bool column
data types if the output produced by the Run() function is correct.
Put the tagger implementation into its own package.

Removed the experimental SQL-tag.
Also refactored and rearranged the code.
Also renamed constructor function to New()
Added a case where given string is empty.

Fixed typo in toInitialisms test.
@fraenky8 fraenky8 merged commit d199cfc into master Jun 24, 2019
@fraenky8 fraenky8 deleted the ISSUE-10 branch June 24, 2019 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add unit tests
1 participant