Skip to content
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

Fixes #1236 Create tests for organization_feed.dart #1478

Conversation

Ayush0Chaudhary
Copy link
Contributor

What kind of change does this PR introduce?
Fixes #1236 Create tests for organization_feed.dart

Issue Number:

Fixes #1236

Did you add tests for your changes?

Summary
Fixes #1236 Create tests for organization_feed.dart

Does this PR introduce a breaking change?
NO

Have you read the contributing guide?
YES

@Ayush0Chaudhary Ayush0Chaudhary force-pushed the Ayush0Chaudhary/organization_feed_test branch from 95bf982 to 3bea609 Compare February 9, 2023 11:33
@Ayush0Chaudhary
Copy link
Contributor Author

I achieved 86.5% coverage

Screenshot from 2023-02-09 17-44-20

Screen Shot for uncovered part
Screenshot from 2023-02-09 17-46-17

@palisadoes @noman2002 @TheHazeEffect

@Ayush0Chaudhary Ayush0Chaudhary force-pushed the Ayush0Chaudhary/organization_feed_test branch from 4f04f70 to a163de5 Compare February 9, 2023 12:31
@literalEval
Copy link
Member

@Ayush0Chaudhary do you need help in getting to 100% ?

@palisadoes
Copy link
Contributor

  1. We are going to have delay any potential merge until this PR is complete Merge GSoD Work into automated-docs (#1459) #1474
  2. It may cause minor merge conflicts, so be prepared

Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to get it to 100%

@Ayush0Chaudhary
Copy link
Contributor Author

Now the coverage is
Screenshot from 2023-02-10 23-28-19

@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2023

Codecov Report

Merging #1478 (cc978d7) into develop (ac0571b) will increase coverage by 0.05%.
The diff coverage is 91.66%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff             @@
##           develop    #1478      +/-   ##
===========================================
+ Coverage    78.63%   78.69%   +0.05%     
===========================================
  Files          146      146              
  Lines         7219     7225       +6     
===========================================
+ Hits          5677     5686       +9     
+ Misses        1542     1539       -3     
Impacted Files Coverage Δ
...feed_view_models/organization_feed_view_model.dart 98.03% <90.90%> (-1.97%) ⬇️
...ews/after_auth_screens/feed/organization_feed.dart 89.18% <100.00%> (+10.81%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@palisadoes
Copy link
Contributor

Please fix the linting error

@Ayush0Chaudhary Ayush0Chaudhary force-pushed the Ayush0Chaudhary/organization_feed_test branch from 1f47281 to 16a14e7 Compare February 10, 2023 18:16
@Ayush0Chaudhary
Copy link
Contributor Author

@noman2002 I was not able to mock stream and and I tried other methods, but was unsuccessful.

@Ayush0Chaudhary
Copy link
Contributor Author

@noman2002 @TheHazeEffect please review!

@Ayush0Chaudhary Ayush0Chaudhary requested review from noman2002 and removed request for TheHazeEffect February 10, 2023 22:16
@noman2002
Copy link
Member

@Ayush0Chaudhary Please don't remove reviewers, it is assigned for a purpose. Please refrain from these type of practice.

@noman2002
Copy link
Member

@noman2002 I was not able to mock stream and and I tried other methods, but was unsuccessful.

You can take help from @literalEval

@palisadoes
Copy link
Contributor

@Ayush0Chaudhary Please don't remove reviewers, it is assigned for a purpose. Please refrain from these type of practice.

I 100% agree. Our volunteers have conflicting priorities and may not always be available on demand, but we are all trying to improve the code base.

@Ayush0Chaudhary
Copy link
Contributor Author

Sorry @palisadoes @noman2002
I tried to ask for re review from Noman and clicked the red icon.

That led to removal of @TheHazeEffect review

It won't happen again, it was not intentional.

@palisadoes
Copy link
Contributor

Sorry @palisadoes @noman2002 I tried to ask for re review from Noman and clicked the red icon.

That led to removal of @TheHazeEffect review

It won't happen again, it was not intentional.

Thanks

@@ -143,6 +143,7 @@ class CreateEventViewModel extends BaseModel {
Future<void> getImageFromGallery({bool camera = false}) async {
final _image =
await _multiMediaPickerService.getPhotoFromGallery(camera: camera);
print(_image);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove print command.


_updatePostSubscription =
_postService.updatedPostStream.listen((post) => updatedPost(post));
print(_posts);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove print

Comment on lines 188 to 256
// tester.allElements.forEach((element) {
// print(element);
// });

// _organizationFeedViewModel.setValueForTest();

// final u1 = User(
// id: '123',
// firstName: 'John',
// lastName: 'Doe',
// email: '[email protected]',
// );
// final u2 = User(
// id: '123',
// firstName: 'Ayush',
// lastName: 'Chaudhary',
// email: '[email protected]',
// );
// final List<User> users = [u1, u2];
//
// final LikedBy l1 = LikedBy(sId: 'test1');
// final LikedBy l2 = LikedBy(sId: 'test2');
// final List<LikedBy> likeby = [l1, l2];
//
// final comment1 = Comments(sId: 'comment1');
// final comment2 = Comments(sId: 'comment2');
// final comment3 = Comments(sId: 'comment3');
// final List<Comments> comments = [comment1, comment2, comment3];
//
// final myBirthday = DateTime.utc(2004, DateTime.june, 16, 5, 30, 0, 0, 0);
// final post = Post(
// creator: User(
// id: '123',
// firstName: 'John',
// lastName: 'Doe',
// email: '[email protected]',
// ),
// sId: "sid",
// createdAt: myBirthday,
// description: 'test description',
// imageUrl: 'https://image.com',
// videoUrl: 'https://image.com',
// organization: OrgInfo(admins: users),
// likedBy: likeby,
// comments: comments,
// );
// final List<Post> posts = [post];
// when(postservice.postStream).
// final StreamController<List<Post>> _streamController = StreamController();
// final Stream<List<Post>> _stream =
// _streamController.stream.asBroadcastStream();

// final service = MockPostService();
// when(service.postStream).thenAnswer((invocation) {
// return _stream;
// });
// postservice.postStream.listen((event) {
// print(11);
// });
// getAndRegisterPostService();
// _streamController.add(posts);
// await tester.drag(
// find.byType(RefreshIndicator),
// const Offset(0, 200),
// );

// await tester.pumpAndSettle(Duration(milliseconds: 100));
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these commented code.

@Ayush0Chaudhary
Copy link
Contributor Author

@noman2002 @palisadoes made the suggested changes.

Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge this but let the issue be open.

@palisadoes palisadoes removed the request for review from TheHazeEffect February 13, 2023 21:24
@palisadoes palisadoes merged commit bdb87b8 into PalisadoesFoundation:develop Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Views: Create tests for organization_feed.dart
5 participants