-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Improved metrics for updating application #5607
Improved metrics for updating application #5607
Conversation
eef9344
to
58a322c
Compare
src/behaviours/application-update/analytics-for-installing-update.test.ts
Show resolved
Hide resolved
*/ | ||
import moment from "moment"; | ||
|
||
export const getCurrentDateTime = () => moment().utc().format(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be an injectable
, so that you don't to do global.Data.now = ...
in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to say yes, but previous experience says that it's best to override Date
by messing with globals, because of the all of the libraries that use it. If we used injectable
for it, then we would have absolute control in our code base, but if (and when) we use some library that uses Date.now
, we will get separate opinion which is easy way encounter hard-to-debug failing unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, thought after talking with @nevalla it seems that the timestamp is received automatically, so we don't need to include it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say let's keep it there. Sometimes it's easier to access data from event itself, and not from the metadata. It all depends from the choice of service that we are using.
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
58a322c
to
84fc925
Compare
No description provided.