@@ -1813,17 +1813,18 @@ void main() {
18131813
18141814 group ('OnNewActivity' , () {
18151815 const feedId = FeedId (group: 'user' , id: 'john' );
1816- const currentUserId = 'luke_skywalker' ;
1817- const otherUserId = 'other_user' ;
1816+ const currentUser = User (id : 'luke_skywalker' ) ;
1817+ const otherUser = User (id : 'other_user' ) ;
18181818
18191819 final initialActivities = [
1820- createDefaultActivityResponse (id: 'activity-1' , userId: currentUserId ),
1821- createDefaultActivityResponse (id: 'activity-2' , userId: currentUserId ),
1822- createDefaultActivityResponse (id: 'activity-3' , userId: otherUserId ),
1820+ createDefaultActivityResponse (id: 'activity-1' , userId: currentUser.id ),
1821+ createDefaultActivityResponse (id: 'activity-2' , userId: currentUser.id ),
1822+ createDefaultActivityResponse (id: 'activity-3' , userId: otherUser.id ),
18231823 ];
18241824
18251825 feedTest (
18261826 'defaultOnNewActivity - should add current user activity to start when matching filter' ,
1827+ user: currentUser,
18271828 build: (client) => client.feedFromQuery (
18281829 FeedQuery (
18291830 fid: feedId,
@@ -1848,7 +1849,7 @@ void main() {
18481849 fid: feedId.rawValue,
18491850 activity: createDefaultActivityResponse (
18501851 id: 'activity-4' ,
1851- userId: currentUserId ,
1852+ userId: currentUser.id ,
18521853 type: 'post' ,
18531854 ),
18541855 ),
@@ -1861,6 +1862,7 @@ void main() {
18611862
18621863 feedTest (
18631864 'defaultOnNewActivity - should ignore activity from other user' ,
1865+ user: currentUser,
18641866 build: (client) => client.feedFromQuery (
18651867 FeedQuery (
18661868 fid: feedId,
@@ -1885,7 +1887,7 @@ void main() {
18851887 fid: feedId.rawValue,
18861888 activity: createDefaultActivityResponse (
18871889 id: 'activity-4' ,
1888- userId: otherUserId ,
1890+ userId: otherUser.id ,
18891891 type: 'post' ,
18901892 ),
18911893 ),
@@ -1897,6 +1899,7 @@ void main() {
18971899
18981900 feedTest (
18991901 'defaultOnNewActivity - should ignore current user activity that does not match filter' ,
1902+ user: currentUser,
19001903 build: (client) => client.feedFromQuery (
19011904 FeedQuery (
19021905 fid: feedId,
@@ -1921,7 +1924,7 @@ void main() {
19211924 fid: feedId.rawValue,
19221925 activity: createDefaultActivityResponse (
19231926 id: 'activity-4' ,
1924- userId: currentUserId ,
1927+ userId: currentUser.id ,
19251928 type: 'comment' , // Doesn't match 'post' filter
19261929 ),
19271930 ),
@@ -1933,6 +1936,7 @@ void main() {
19331936
19341937 feedTest (
19351938 'custom onNewActivity - should add to start' ,
1939+ user: currentUser,
19361940 build: (client) => client.feedFromQuery (
19371941 const FeedQuery (fid: feedId),
19381942 onNewActivity: (query, activity, currentUserId) {
@@ -1955,7 +1959,7 @@ void main() {
19551959 fid: feedId.rawValue,
19561960 activity: createDefaultActivityResponse (
19571961 id: 'activity-4' ,
1958- userId: otherUserId ,
1962+ userId: otherUser.id ,
19591963 ),
19601964 ),
19611965 );
@@ -1967,6 +1971,7 @@ void main() {
19671971
19681972 feedTest (
19691973 'custom onNewActivity - should add to end' ,
1974+ user: currentUser,
19701975 build: (client) => client.feedFromQuery (
19711976 const FeedQuery (fid: feedId),
19721977 onNewActivity: (query, activity, currentUserId) {
@@ -1989,7 +1994,7 @@ void main() {
19891994 fid: feedId.rawValue,
19901995 activity: createDefaultActivityResponse (
19911996 id: 'activity-4' ,
1992- userId: otherUserId ,
1997+ userId: otherUser.id ,
19931998 ),
19941999 ),
19952000 );
@@ -2001,6 +2006,7 @@ void main() {
20012006
20022007 feedTest (
20032008 'custom onNewActivity - should ignore' ,
2009+ user: currentUser,
20042010 build: (client) => client.feedFromQuery (
20052011 const FeedQuery (fid: feedId),
20062012 onNewActivity: (query, activity, currentUserId) {
@@ -2023,7 +2029,7 @@ void main() {
20232029 fid: feedId.rawValue,
20242030 activity: createDefaultActivityResponse (
20252031 id: 'activity-4' ,
2026- userId: currentUserId ,
2032+ userId: currentUser.id ,
20272033 ),
20282034 ),
20292035 );
@@ -2034,6 +2040,7 @@ void main() {
20342040
20352041 feedTest (
20362042 'custom onNewActivity - should use query and activity context' ,
2043+ user: currentUser,
20372044 build: (client) => client.feedFromQuery (
20382045 FeedQuery (
20392046 fid: feedId,
@@ -2067,7 +2074,7 @@ void main() {
20672074 fid: feedId.rawValue,
20682075 activity: createDefaultActivityResponse (
20692076 id: 'activity-4' ,
2070- userId: otherUserId ,
2077+ userId: otherUser.id ,
20712078 type: 'post' ,
20722079 ),
20732080 ),
@@ -2085,7 +2092,7 @@ void main() {
20852092 fid: feedId.rawValue,
20862093 activity: createDefaultActivityResponse (
20872094 id: 'activity-5' ,
2088- userId: otherUserId ,
2095+ userId: otherUser.id ,
20892096 type: 'comment' , // Doesn't match 'post' filter
20902097 ),
20912098 ),
0 commit comments