-
Notifications
You must be signed in to change notification settings - Fork 118
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: added test for Processor.go functions #1124
base: main
Are you sure you want to change the base?
Conversation
Thanks for making a pull request! 😃 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1124 +/- ##
==========================================
+ Coverage 14.89% 15.15% +0.26%
==========================================
Files 90 90
Lines 8380 8380
==========================================
+ Hits 1248 1270 +22
+ Misses 6809 6777 -32
- Partials 323 333 +10 ☔ View full report in Codecov by Sentry. |
Thank you for the contribution @satyazzz123 Can you add more test cases to this PR to cover other functions in this file (processor.go)? cc @seshapad |
Yes , I am working on other test cases as well will soon raise a PR soon covering more functions and cases |
Lets expand the scope of this PR (instead of creating new ones) to test complete processor.go. |
Got it will push commits to this PR itself adding more tests |
@kmehant I have added some more test cases . Please have a look |
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.
Please flesh out the tests to be more meaningful. Most of the fields and callbacks are empty/nil and the tests don't actually test anything.
processor := newProcessor(mockOptions) | ||
|
||
// Check that the returned processor is not nil | ||
if processor == nil { |
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.
Also check if the config and callbacks are preserved.
err := processor.processFile(source, destination) | ||
|
||
// Assert the result | ||
if err != nil { |
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.
Fix formatting
|
||
t.Run("test for the scenario where the processing of a file is successful", func(t *testing.T) { | ||
source := "path/to/source/file.txt" | ||
destination := "path/to/destination/file.txt" |
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.
Fix formatting
err := processor.processFile(source, destination) | ||
|
||
// Assert the result | ||
if err != nil { |
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.
Also check if the file was processed correctly.
related #1071 |
@satyazzz123 any update on this PR referring to @HarikrishnanBalagopal's review? |
Yes I am working on the changes right now will soon push the changes also adding some more test cases to increase test coverage for processor.go functions |
There were some new tests I had added to processor.go but they were failing before I am fixing them and raising a PR. Sorry for the delay 😥 |
Signed-off-by: satyazzz123 <[email protected]>
Signed-off-by: satyazzz123 <[email protected]>
Signed-off-by: satyazzz123 <[email protected]>
Signed-off-by: satyazzz123 <[email protected]>
Signed-off-by: satyazzz123 <[email protected]>
Signed-off-by: satyazzz123 <[email protected]>
Signed-off-by: satyazzz123 <[email protected]>
28e166f
to
171948c
Compare
test for filesystem processor.go functions
i) this test case covers a scenario where it checks if newProcessor function creates a processor instance with the given options.
ii) test for the scenario where the processFile function is able to succesfully process the file.
iii)test for scenario when processDirectory successfully processes an existing source and existing destination directory.
iv) test for sceanrio when process function succesfully processes an existing source and existing destination directory.
partly fixes #881