-
Notifications
You must be signed in to change notification settings - Fork 12
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
test(Predictions): Added the mox for predictions #2036
Merged
Merged
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5d51a66
test(Predictions): Added the mox for predictions
kotva006 eacd9bb
Added behaviour
kotva006 9ca4253
Configured predictions repo, and updated predictions controller tests
kotva006 4a64af7
Updated the prediction schedule and corresponding test
kotva006 480a754
Updated realtime schedules to use prediction repo
kotva006 29083ce
Added updated the tests for transit near me
kotva006 f527f74
Updated the vehicle marker channel to use new predictions repo
kotva006 6bfb63a
Updated the finder_api to use the predictions repo pattern
kotva006 fed8c3f
Added new repo model to green
kotva006 c7156f6
Added test pattern to trip_info
kotva006 8b60f94
Removed function injection from green
kotva006 0741e96
Removed predictions injection
kotva006 28860fb
Alphabatized the configuration
kotva006 5b59541
Cleaned up predictions_test file
kotva006 bb4bba6
Fixed spacing
kotva006 57e4ad0
Moved repo mocks to own section
kotva006 2891ee0
Added prediction factory
kotva006 39ebb47
Added missing file
kotva006 dfe967f
Added faker to predictions test
kotva006 b3be441
Added more factory usage for predictions and some random data
kotva006 77b1aa2
Remove redundant defaults
kotva006 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ defmodule Dotcom.RealtimeSchedule do | |
alias Dotcom.JsonHelpers | ||
alias Dotcom.TransitNearMe | ||
alias Predictions.Prediction | ||
alias Predictions.Repo, as: PredictionsRepo | ||
alias RoutePatterns.RoutePattern | ||
alias Routes.Repo, as: RoutesRepo | ||
alias Routes.Route | ||
|
@@ -25,10 +24,12 @@ defmodule Dotcom.RealtimeSchedule do | |
|
||
@predicted_schedules_per_stop 2 | ||
|
||
@predictions_repo Application.compile_env!(:dotcom, :repo_modules)[:predictions] | ||
|
||
@default_opts [ | ||
stops_fn: &StopsRepo.get/1, | ||
routes_fn: &RoutesRepo.by_stop_with_route_pattern/1, | ||
predictions_fn: &PredictionsRepo.all_no_cache/1, | ||
predictions_fn: Function.capture(@predictions_repo, :all_no_cache, 1), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should just remove the dependency injection. It's pretty simple to just replace all instances of |
||
schedules_fn: &SchedulesRepo.by_route_ids/2, | ||
alerts_fn: &Alerts.Repo.by_route_ids/2 | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule Predictions.Repo.Behaviour do | ||
@moduledoc """ | ||
Behavior for an API client for fetching prediction data. | ||
""" | ||
|
||
@doc """ | ||
Return predictions for given params | ||
""" | ||
@callback all(Keyword.t()) :: [Predictions.Prediction.t()] | [] | ||
|
||
@doc """ | ||
Return predictions for give prarams ignoring the cache | ||
""" | ||
@callback all_no_cache(Keyword.t()) :: [Predictions.Prediction.t()] | [] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should alphabetize this list and the one above because they are going to be quite long.