-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
Merged
palisadoes
merged 15 commits into
PalisadoesFoundation:develop
from
Ayush0Chaudhary:Ayush0Chaudhary/organization_feed_test
Feb 13, 2023
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
971a204
draft
Ayush0Chaudhary f605d9a
draft2
Ayush0Chaudhary c598d40
draft
Ayush0Chaudhary f604829
draft
Ayush0Chaudhary 24539b8
draft 2
Ayush0Chaudhary 52a881a
Fixes #1236 Create tests for organization_feed.dart
Ayush0Chaudhary 3bea609
resolved conflicts
Ayush0Chaudhary 589c200
rmv unused imports
Ayush0Chaudhary a163de5
testing issue
Ayush0Chaudhary 16a14e7
Improve Coverage
Ayush0Chaudhary 34a6916
Merge branch 'develop' into Ayush0Chaudhary/organization_feed_test
Ayush0Chaudhary 7fb481b
Update create_event_view_model.dart
Ayush0Chaudhary 7f5988a
Update organization_feed_view_model.dart
Ayush0Chaudhary db6ebc2
Update organization_feed_test.dart
Ayush0Chaudhary cc978d7
Update organization_feed_test.dart
Ayush0Chaudhary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,8 @@ class OrganizationFeedViewModel extends BaseModel { | |
// Local caching variables for a session. | ||
// ignore: prefer_final_fields | ||
List<Post> _posts = []; | ||
final List<Post> _pinnedPosts = | ||
bool istest = false; | ||
List<Post> _pinnedPosts = | ||
pinnedPostsDemoData.map((e) => Post.fromJson(e)).toList(); | ||
final Set<String> _renderedPostID = {}; | ||
late String _currentOrgName = ""; | ||
|
@@ -38,8 +39,22 @@ class OrganizationFeedViewModel extends BaseModel { | |
late StreamSubscription _updatePostSubscription; | ||
|
||
// Getters | ||
List<Post> get posts => _posts; | ||
List<Post> get pinnedPosts => _pinnedPosts; | ||
List<Post> get posts { | ||
// if (istest) { | ||
// _posts = pinnedPostsDemoData.map((e) => Post.fromJson(e)).toList(); | ||
// return _posts; | ||
// } | ||
return _posts; | ||
} | ||
|
||
List<Post> get pinnedPosts { | ||
if (istest) { | ||
_pinnedPosts = []; | ||
return _pinnedPosts; | ||
} | ||
return _pinnedPosts; | ||
} | ||
|
||
String get currentOrgName => _currentOrgName; | ||
|
||
/// This function sets the organization name after update. | ||
|
@@ -62,9 +77,11 @@ class OrganizationFeedViewModel extends BaseModel { | |
_postService.getPosts(); | ||
} | ||
|
||
// initialiser | ||
void initialise() { | ||
// For caching/initalizing the current organization after the stream subsciption has canceled and the stream is updated | ||
void initialise( | ||
// bool forTest, | ||
{bool isTest = false}) { | ||
// For caching/initializing the current organization after the stream subscription has canceled and the stream is updated | ||
|
||
_currentOrgName = _userConfig.currentOrg.name!; | ||
// ------ | ||
// Attaching the stream subscription to rebuild the widgets automatically | ||
|
@@ -73,21 +90,25 @@ class OrganizationFeedViewModel extends BaseModel { | |
(updatedOrganization) => | ||
setCurrentOrganizationName(updatedOrganization.name!), | ||
); | ||
|
||
_postsSubscription = | ||
_postService.postStream.listen((newPosts) => buildNewPosts(newPosts)); | ||
_postsSubscription = _postService.postStream.listen((newPosts) { | ||
return buildNewPosts(newPosts); | ||
}); | ||
|
||
_updatePostSubscription = | ||
_postService.updatedPostStream.listen((post) => updatedPost(post)); | ||
print(_posts); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove print |
||
if (isTest) { | ||
istest = true; | ||
} | ||
} | ||
|
||
void initializeWithDemoData() { | ||
// final postJsonResult = postsDemoData; | ||
|
||
// | ||
// ------ | ||
// Calling function to ge the post for the only 1st time. | ||
// // Calling function to ge the post for the only 1st time. | ||
// _postService.getPosts(); | ||
|
||
// | ||
// //fetching pinnedPosts | ||
// final pinnedPostJsonResult = pinnedPostsDemoData; | ||
// pinnedPostJsonResult.forEach((pinnedPostJsonData) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remove print command.