@@ -105,19 +105,23 @@ func TestStepCRUD(t *testing.T) {
105105
106106func TestReactionCRUD (t * testing.T ) {
107107 h := newHarness (t )
108+ userID := currentUserID (t , h )
108109 cardStr := strconv .Itoa (fixture .CardNumber )
110+ cardReactionContent := "+1"
111+ commentReactionContent := "heart"
112+
109113 cardReactionsBefore := h .Run ("reaction" , "list" , "--card" , cardStr )
110114 assertOK (t , cardReactionsBefore )
111115 commentReactionsBefore := h .Run ("reaction" , "list" , "--card" , cardStr , "--comment" , fixture .CommentID )
112116 assertOK (t , commentReactionsBefore )
113117
114- cardReaction := h .Run ("reaction" , "create" , "--card" , cardStr , "--content" , "+1" )
118+ cardReaction := h .Run ("reaction" , "create" , "--card" , cardStr , "--content" , cardReactionContent )
115119 assertOK (t , cardReaction )
116120 cardReactions := h .Run ("reaction" , "list" , "--card" , cardStr )
117121 assertOK (t , cardReactions )
118- cardReactionID := listAddedID (cardReactionsBefore .GetDataArray (), cardReactions .GetDataArray ())
122+ cardReactionID := addedReactionID (cardReactionsBefore .GetDataArray (), cardReactions .GetDataArray (), cardReactionContent , userID )
119123 if cardReactionID == "" {
120- t .Fatal ("expected created card reaction to appear in list" )
124+ t .Fatal ("expected exactly one created card reaction for the current user to appear in list" )
121125 }
122126 t .Cleanup (func () {
123127 if cardReactionID != "" {
@@ -136,13 +140,13 @@ func TestReactionCRUD(t *testing.T) {
136140 t .Fatalf ("expected deleted card reaction %q to be absent from list" , deletedCardReactionID )
137141 }
138142
139- commentReaction := h .Run ("reaction" , "create" , "--card" , cardStr , "--comment" , fixture .CommentID , "--content" , "heart" )
143+ commentReaction := h .Run ("reaction" , "create" , "--card" , cardStr , "--comment" , fixture .CommentID , "--content" , commentReactionContent )
140144 assertOK (t , commentReaction )
141145 commentReactions := h .Run ("reaction" , "list" , "--card" , cardStr , "--comment" , fixture .CommentID )
142146 assertOK (t , commentReactions )
143- commentReactionID := listAddedID (commentReactionsBefore .GetDataArray (), commentReactions .GetDataArray ())
147+ commentReactionID := addedReactionID (commentReactionsBefore .GetDataArray (), commentReactions .GetDataArray (), commentReactionContent , userID )
144148 if commentReactionID == "" {
145- t .Fatal ("expected created comment reaction to appear in list" )
149+ t .Fatal ("expected exactly one created comment reaction for the current user to appear in list" )
146150 }
147151 t .Cleanup (func () {
148152 if commentReactionID != "" {
0 commit comments