Replies: 1 comment
-
What I ended up deciding to be my chosen method to go forward with this package to keep everything tidy is that I'll have If I decide to make them available to the public, I can simply add another library to export there. But I think this will at least make them testable and make sure that the package users don't get confused with a bunch of extra helping methods inside an |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Related to #17, #18 and #19.
As I was developing #20, I encountered a question I'd like to discuss here.
Context
I created the
shared_private.dart
and developed thegetWorkdayNumberInMonth
function inside it. This function is used inside both classes and is tested by itself as well as from inside the classes calls to it.Main discussion topic
Inside
EveryDueWorkdayMonth.next
andEveryDueWorkdayMonth.previous
, I call_calculate
, this private method processes the received date with the same custom logic for both methods.Implementation of
_calculate
There is a specific part of the implementation of
_calculate
I'd like to discuss:This part of the implementation covers and makes sure that some calculations are not irrelevant. Since we know that we can skip some days.
Now, here is the thing, inside
next
andprevious
an anonymous function is passed as thedateGeneratorFunction
parameter for_calculate
.Implementation of
next
Implementation of
previous
From these implementations, I'd like to discuss the following lines:
From
next
:From
previous
:Main question
When running tests and code coverage (#22) for these new classes, I found that the lines I mentioned above from
next
andprevious
methods are not being run even once. Of course that has to do with the first bit I mentioned about the_calculate
function.What should I do now;
next
andprevious
this test._calculate
and leave it tonext
andprevious
.In this last case, which I'm leaning more towards. Do I create a new class to put them in and test them? Maybe add
getWorkdayNumberInMonth
inside as well?Should I do the same thing I did with
getWorkdayNumberInMonth
? I'm not completely sure about leaving the three functions unrelated to each other.Last thing, if I do this, any ideas about how to name them?
Beta Was this translation helpful? Give feedback.
All reactions