talawa icon indicating copy to clipboard operation
talawa copied to clipboard

Views: Create tests for organization_feed.dart

Open palisadoes opened this issue 2 years ago • 20 comments

  • Please coordinate issue assignment and PR reviews with the contributors listed in this issue https://github.com/PalisadoesFoundation/talawa/issues/359

The Talawa code base needs to be 100% reliable. This means we need to have 100% test code coverage.

Tests need to be written for file lib/views/after_auth_screens/feed/organization_feed.dart

  • When complete, all methods, classes and/or functions in the file will need to be tested.
  • These tests must be placed in a single file with the name test/views/after_auth_screens/feed/organization_feed_test.dart. You may need to create the appropriate directory structure to do this.

IMPORTANT:

Please refer to the parent issue on how to implement these tests correctly:

  • https://github.com/PalisadoesFoundation/talawa/issues/1217

PR Acceptance Criteria

  • When complete this file must show 100% coverage when merged into the code base. This will be clearly visible when you submit your PR.
  • The current code coverage for the file can be found here. If the file isn't found in this directory, or there is a 404 error, then tests have not been created.
  • The PR will show a report for the code coverage for the file you have added. You can use that as a guide.
  • You can verify your own code coverage by creating an account at Codecov.io
  • No functionality must be removed to achieve this goal

palisadoes avatar Feb 28 '22 22:02 palisadoes

i wolud like to solve this issue please assign to me

harshitraisahab avatar Dec 22 '22 04:12 harshitraisahab

Unassigned due to inactivity.

noman2002 avatar Jan 31 '23 12:01 noman2002

@noman2002 @palisadoes @TheHazeEffect please assign this issue to me!

Ayush0Chaudhary avatar Feb 06 '23 16:02 Ayush0Chaudhary

I am facing a issue solving this issue. https://github.com/PalisadoesFoundation/talawa/blob/311b205a8371eee891e5bef1a794f904295cd6cb/lib/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart#L51-L67

the above code uses a stream and set value of _post variable

But all the test written return null, I was not able to find a test where actual post list was returned

@noman2002 @palisadoes can you help me with this

I have achieved 90% coverage but small part require the actual post to test https://github.com/PalisadoesFoundation/talawa/blob/311b205a8371eee891e5bef1a794f904295cd6cb/lib/views/after_auth_screens/feed/organization_feed.dart#L60-L64

Ayush0Chaudhary avatar Feb 07 '23 19:02 Ayush0Chaudhary

https://github.com/PalisadoesFoundation/talawa/blob/311b205a8371eee891e5bef1a794f904295cd6cb/test/widget_tests/after_auth_screens/events/explore_events_test.dart#L158-L178

one posiible solution is this but it return a null value

Ayush0Chaudhary avatar Feb 07 '23 20:02 Ayush0Chaudhary

@noman2002 @TheHazeEffect Do you have any thoughts on how to resolve this?

palisadoes avatar Feb 08 '23 06:02 palisadoes

IntelliJ Snippet

@palisadoes @noman2002 @TheHazeEffect I implemented this and 11 is getting printed but same thing is not happening in its viewmodel Their is a problem with the scope of Mock Can you help me with this??

Ayush0Chaudhary avatar Feb 08 '23 20:02 Ayush0Chaudhary

@literalEval can you suggest something??

Ayush0Chaudhary avatar Feb 09 '23 14:02 Ayush0Chaudhary

@Ayush0Chaudhary I believe your reference of the view model is different then the one that the widget is using, I mean both are different instances.

I was having the same issue while writing tests for a widget and I worked it around by referencing the view model used by the widget directly. Something like

late VM _vm;
....
....
BaseView<VM> (
  onModelReady: (model) {
    _vm = model;
  }
)

This way you can be sure that you are referencing the exact same view model.

literalEval avatar Feb 09 '23 15:02 literalEval

@literalEval You can try on this issue.

Ayush0Chaudhary avatar Feb 10 '23 18:02 Ayush0Chaudhary

Sure. I will take this issue once I am done with the issues I am already assigned with.

literalEval avatar Feb 11 '23 06:02 literalEval

This is reopened because test coverage for this file is not acceptable.

Cioppolo14 avatar Dec 25 '23 03:12 Cioppolo14

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

github-actions[bot] avatar Jan 05 '24 00:01 github-actions[bot]

Can you please assign this issue to me.

Cyclotron17 avatar Jan 12 '24 13:01 Cyclotron17

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

github-actions[bot] avatar Jan 23 '24 00:01 github-actions[bot]

Unassigning due to inactivity.

Cioppolo14 avatar Jan 23 '24 01:01 Cioppolo14

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

github-actions[bot] avatar Feb 03 '24 00:02 github-actions[bot]

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

github-actions[bot] avatar Feb 15 '24 00:02 github-actions[bot]