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

Increase test coverage #539

Merged
merged 3 commits into from
Apr 22, 2021
Merged

Increase test coverage #539

merged 3 commits into from
Apr 22, 2021

Conversation

mqus
Copy link
Collaborator

@mqus mqus commented Apr 20, 2021

This PR pushes the test coverage over the magic 90% :)

Some errors from the change method processors were pulled out but the rest is pretty much just more tests.

I tried to tackle the biggest target in the codecov heatmap, value_objects, but while the equals methods seem simple, the hashCode methods are wrong in most cases, because the hashCode of dart Elements can be different even if the dart elements themselves are equal (==). But the value objects also don't really benefit all that much from testing since they only have trivial methods left.

So I took the next best target, error messages. Aside from those there are only two tests (database writer with daoGetters and entity processor with indices) that cover something else. I catched a single issue where the equals method of Index was not 100% correct(should only be an internal problem at the very most, if it mattered at all) but nothing apart from that.

There is also one test that I had to set to skip because I could not figure out how to trigger that specific error message (EntityProcessorError.foreignKeyDoesNotReferenceEntity). I can also remove that if there is no "solution" ;)

@mqus mqus added the refactoring Improvement without changing functionality label Apr 20, 2021
@codecov
Copy link

codecov bot commented Apr 20, 2021

Codecov Report

❗ No coverage uploaded for pull request base (develop@c3cdb4a). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #539   +/-   ##
==========================================
  Coverage           ?   90.04%           
==========================================
  Files              ?       74           
  Lines              ?     1858           
  Branches           ?        0           
==========================================
  Hits               ?     1673           
  Misses             ?      185           
  Partials           ?        0           
Flag Coverage Δ
floor 90.42% <ø> (?)
floor_generator 90.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rator/lib/processor/deletion_method_processor.dart 100.00% <100.00%> (ø)
...processor/error/change_method_processor_error.dart 100.00% <100.00%> (ø)
...ator/lib/processor/insertion_method_processor.dart 100.00% <100.00%> (ø)
...nerator/lib/processor/update_method_processor.dart 100.00% <100.00%> (ø)
floor_generator/lib/value_object/index.dart 65.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c3cdb4a...b69cfe3. Read the comment docs.

Copy link
Collaborator

@vitusortner vitusortner left a comment

Choose a reason for hiding this comment

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

Many thanks for making the effort of writing these tests!

@@ -25,7 +27,7 @@ class Index {
name == other.name &&
tableName == other.tableName &&
unique == other.unique &&
columnNames == other.columnNames;
const ListEquality<String>().equals(columnNames, other.columnNames);
Copy link
Collaborator

Choose a reason for hiding this comment

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

🙏 Well spotted!

@mqus mqus merged commit 98333a4 into pinchbv:develop Apr 22, 2021
@mqus mqus deleted the better-testcoverage branch March 12, 2022 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Improvement without changing functionality
Development

Successfully merging this pull request may close these issues.

2 participants