PalisadoesFoundation / talawa

Community Organization Management Software. Click on the link below to see our documentation.
https://docs.talawa.io/
GNU General Public License v3.0
311 stars 438 forks source link

Views: Create tests for organization_feed.dart #1236

Open palisadoes opened 2 years ago

palisadoes commented 2 years ago

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

IMPORTANT:

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

PR Acceptance Criteria

harshitraisahab commented 1 year ago

i wolud like to solve this issue please assign to me

noman2002 commented 1 year ago

Unassigned due to inactivity.

Ayush0Chaudhary commented 1 year ago

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

Ayush0Chaudhary commented 1 year ago

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 commented 1 year ago

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

palisadoes commented 1 year ago

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

Ayush0Chaudhary commented 1 year ago

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 commented 1 year ago

@literalEval can you suggest something??

literalEval commented 1 year ago

@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.

Ayush0Chaudhary commented 1 year ago

@literalEval You can try on this issue.

literalEval commented 1 year ago

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

Cioppolo14 commented 9 months ago

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

github-actions[bot] commented 8 months ago

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.

Cyclotron17 commented 8 months ago

Can you please assign this issue to me.

github-actions[bot] commented 8 months ago

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.

Cioppolo14 commented 8 months ago

Unassigning due to inactivity.

github-actions[bot] commented 7 months ago

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] commented 7 months ago

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] commented 1 month ago

This issue did not get any activity in the past 180 days and thus has been closed. Please check if the newest release or develop branch has it fixed. Please, create a new issue if the issue is not fixed.

github-actions[bot] commented 1 month ago

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.