-
Notifications
You must be signed in to change notification settings - Fork 114
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
Rewrite angular service - input-matcher #1061
Rewrite angular service - input-matcher #1061
Conversation
resolved merge conflicts |
As discussed in PR e-mission#1061, Jiji is working on setting up a folder in `www/js/` to contain many of our type interfaces and templates. For now, I've added my own `fileIOTypes.ts`. We discussed the types added so far, and found we were working with overlapping types! As such, I plan to copy over her version of `DiaryTypes.ts` found in commit ffcc871, and will use that to replace the current dataObj interface in `controlHelper.test.ts`. Changes made: - Set up `www/js/types`, moved fsWindow interface there - Added basic tests for createWriteFile
- While the types themselves may be subject to change, the goal is to set up a good foundation for strict typing in the future! As such, I added some to a basic version of Jiji's diaryTypes (see PR e-mission#1061), and will be updating those regularly.
…-mission-phone into input-matcher-rewrite
@shankari So what do we want to do with this PR? Are we going to change the tests to match the ones on the server (#1061 (comment))? Are we going to do that now or later? One other option is to let #1086 absorb this PR since it includes these changes and builds on top of them. We could leave this PR open and come back to it when we figure out the testing strategy. |
@JGreenlee thanks for the clarification around This wasn't in "Ready for review", so I'm going to go and review #1086 for now just in case there's anything else pending here. But the tests are passing, so if this is moved into the correct column, I am happy to merge ASAP |
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.
It is really hard to review this change given the extraneous whitespace.
@jiji14 @JGreenlee can one of you please fix the prettier issues so that I can focus on the actual changes?
@shankari Let me fix this! |
I deleted [ before ] .factory(
'EnketoNotesButtonService',
function (InputMatcher, EnketoSurveyAnswer, Logger, $timeout) {
var enbs = {}; [ after ] .factory('EnketoNotesButtonService', function (EnketoSurveyAnswer, Logger, $timeout) {
var enbs = {}; |
Interesting that Prettier actually changes the indent level based on one line being longer or shorter. I agree and think you should leave it how it is. When we look at the diff, we can just enable the 'Hide whitespace' option to make it easier to review |
@jiji14 if there is a real change in the line, I am OK with associate whitespace changes. I just don't like whitespace changes with no associated code changes caused by different editors.
I will probably not use "Hide whitespace" because it will also hide the spurious whitespace changes. But maybe if Prettier ensures that we never get those... |
Although it is really annoying that because of the difference in indentation, pretty much every single line was changed. Let's see how often this happens before deciding... |
@JGreenlee I just merged this. If you pull it into #1086 I can review that tomorrow. |
Rewrite
input-matcher.js
Angular serviceRelated Issue: GitHub Issue #1001
Input-matcher
is a function designed to check if the user's trip input is correct and print logs. I've kept the fundamental logic while updating the old JavaScript syntax and adding input/output types for each function.1. Replacing
moment
withLuxon
Previously, the Moment format function was used to print logs. I have replaced
moment
withLuxon
.Here's a comparison of the two outputs:
2. Unit Testing
I have written test cases for both valid and invalid inputs for each function. To ensure proper testing, please add
"testEnvironment": "jsdom"
to yourjest.config.json
(I haven't pushed the update forjest.config.json
to avoid conflicts).Here are the test results:
I had to merge
onboarding_routing_sept_2023
branch becauseservice_rewrite_2023
is too out-dated.