Add test case for graph controller - #1801
Conversation
Coverage Report for CI Build 35521578849Coverage increased (+0.02%) to 59.839%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
| retrievedResult <- liftIO $ Models.Graph.getGraph graphName | ||
| let expectedValue = fmap addDefaults (decode payload :: Maybe Value) | ||
| assertEqual ("Unexpected response for " ++ label) expectedValue retrievedResult | ||
| when (isNothing expectedValue) $ |
There was a problem hiding this comment.
You have the right idea for this test case, but it's a little awkward to add this case to the existing function runSaveGraphJSONTest because the test behaviour is quite different (which is why you used when).
Instead, you can define a new test runSaveGraphJSONInvalidJSONTest :: TestTree which hard-codes the specific invalid JSON input; then add this new test case to the full list of test cases defined at the bottom of this file.
There was a problem hiding this comment.
Thanks! I see how it is quite awkward. I have refactored the new test as prescribed.
| - Switched CI provider from CircleCI to GitHub Actions | ||
| - Cleared up documentation for various graph-related front-end functions | ||
| - Adopted TypeScript v7 into build and CI pipelines and converted `js/components/graph/Button.js` to `Button.tsx` as a proof of concept | ||
| - Added test case coverage for `app/Controllers/Graph.hs` |
There was a problem hiding this comment.
be more specific about what case is being covered here
There was a problem hiding this comment.
Yes. I have updated it with more details.
david-yz-liu
left a comment
There was a problem hiding this comment.
Nice work, @PeanutPiglet!
Proposed Changes
This pull request adds a test case for the saveGraphJSON function in the graph controller.
Previously, the function was not tested on invalid inputs. See Coveralls report.
https://coveralls.io/builds/81681939/source?filename=app%2FControllers%2FGraph.hs
The new test case covers this.
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
Before opening your pull request:
After opening your pull request:
Questions and Comments
(Include any questions or comments you have regarding your changes.)