Lorem Ipsum dolor sit amet
", }, { name: "one user at the beginning", - text: "@user1 Lorem Ipsum", + text: `@user1 Lorem Ipsum
`, wantUsers: []*user.User{user1}, }, { name: "one user at the end", - text: "Lorem Ipsum @user1", + text: `Lorem Ipsum @user1
`, wantUsers: []*user.User{user1}, }, { name: "one user in the middle", - text: "Lorem @user1 Ipsum", + text: `Lorem @user1 Ipsum
`, wantUsers: []*user.User{user1}, }, { name: "same user multiple times", - text: "Lorem @user1 Ipsum @user1 @user1", + text: `Lorem @user1 Ipsum @user1 @user1
`, wantUsers: []*user.User{user1}, }, { name: "Multiple users", - text: "Lorem @user1 Ipsum @user2", + text: `Lorem @user1 Ipsum @user2
`, wantUsers: []*user.User{user1, user2}, }, } @@ -103,7 +103,7 @@ func TestSendingMentionNotification(t *testing.T) { task, err := GetTaskByIDSimple(s, 32) require.NoError(t, err) tc := &TaskComment{ - Comment: "Lorem Ipsum @user1 @user2 @user3 @user4 @user5 @user6", + Comment: `Lorem Ipsum @user1 @user2 @user3 @user4 @user5 @user6
`, TaskID: 32, // user2 has access to the project that task belongs to } err = tc.Create(s, u) @@ -156,7 +156,7 @@ func TestSendingMentionNotification(t *testing.T) { task, err := GetTaskByIDSimple(s, 32) require.NoError(t, err) tc := &TaskComment{ - Comment: "Lorem Ipsum @user2", + Comment: `Lorem Ipsum @user2
`, TaskID: 32, // user2 has access to the project that task belongs to } err = tc.Create(s, u) @@ -170,7 +170,7 @@ func TestSendingMentionNotification(t *testing.T) { _, err = notifyMentionedUsers(s, &task, tc.Comment, n) require.NoError(t, err) - _, err = notifyMentionedUsers(s, &task, "Lorem Ipsum @user2 @user3", n) + _, err = notifyMentionedUsers(s, &task, `Lorem Ipsum @user2 @user3
`, n) require.NoError(t, err) // The second time mentioning the user in the same task should not create another notification diff --git a/pkg/models/task_comments_test.go b/pkg/models/task_comments_test.go index e12cd641d..c2a0cf63c 100644 --- a/pkg/models/task_comments_test.go +++ b/pkg/models/task_comments_test.go @@ -75,7 +75,7 @@ func TestTaskComment_Create(t *testing.T) { task, err := GetTaskByIDSimple(s, 32) require.NoError(t, err) tc := &TaskComment{ - Comment: "Lorem Ipsum @user2", + Comment: `Lorem Ipsum @user2
`, TaskID: 32, // user2 has access to the project that task belongs to } err = tc.Create(s, u)