-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: enhance mention logic (#188)
* feat: update dependencies and improve mention detection - upgrade Go version in go.mod to 1.23 and specify toolchain - update several dependencies to their latest versions - change mention detection to use regular expressions for better accuracy - add tests for mention detection to verify correctness * feat: upgrade version
- Loading branch information
1 parent
6d368de
commit f8ac056
Showing
10 changed files
with
84 additions
and
21 deletions.
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
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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package utils_test | ||
|
||
import ( | ||
"github.com/aldinokemal/go-whatsapp-web-multidevice/pkg/utils" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestContainsMention(t *testing.T) { | ||
type args struct { | ||
message string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want []string | ||
}{ | ||
{ | ||
name: "should success get phone when @ with space", | ||
args: args{message: "welcome @6289123 ."}, | ||
want: []string{"6289123"}, | ||
}, | ||
{ | ||
name: "should success get phone without suffix space", | ||
args: args{message: "welcome @6289123."}, | ||
want: []string{"6289123"}, | ||
}, | ||
{ | ||
name: "should success get phone without prefix space", | ||
args: args{message: "welcome@6289123.@hello:@62891823"}, | ||
want: []string{"6289123", "62891823"}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got := utils.ContainsMention(tt.args.message) | ||
assert.Equal(t, tt.want, got) | ||
}) | ||
} | ||
} |