test: added test for Processor.go functions - #1124
Conversation
|
Thanks for making a pull request! 😃 |
Codecov Report✅ All 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 Harness. 🚀 New features to boost your workflow:
|
|
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 |
| processor := newProcessor(mockOptions) | ||
|
|
||
| // Check that the returned processor is not nil | ||
| if processor == nil { |
There was a problem hiding this comment.
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.
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.
Fix formatting
| err := processor.processFile(source, destination) | ||
|
|
||
| // Assert the result | ||
| if err != nil { |
There was a problem hiding this comment.
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 <beherasatyajit716@gmail.com>
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
Signed-off-by: satyazzz123 <beherasatyajit716@gmail.com>
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