Skip to content

Commit

Permalink
Add test for continuous emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
tmdvs committed Jun 4, 2019
1 parent 0c700d2 commit 2d1cb1f
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tests/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/wubin1989/Go-Emoji-Utils"
tmdvsGoEmojiUtils "github.com/tmdvs/Go-Emoji-Utils"
emoji "github.com/tmdvs/Go-Emoji-Utils"
)

func BenchmarkSearch(b *testing.B) {
Expand Down Expand Up @@ -38,6 +37,18 @@ func TestRemoveAllEmoji(t *testing.T) {

}

func TestContinuousEmoji(t *testing.T) {
str := "abc🙏🙏🙏🙏🙏"

matches := emoji.FindAll(str)
totalUniqueEmoji := len(matches)

assert.Equal(t, totalUniqueEmoji, 1, "There should be 1 unique emoji")

emojiRemoved := emoji.RemoveAll(str)
assert.Equal(t, "abc", emojiRemoved, "There should be no emoji")
}

func TestRemoveAllEmojiChinese(t *testing.T) {

str := "起坎特在🇫🇷队的作用更 哈哈哈"
Expand Down Expand Up @@ -103,7 +114,7 @@ func TestOutOfRangeError(t *testing.T) {

assert.Equal(t, totalUniqueEmoji, 4, "There should be one emoji")

emojiRemoved := tmdvsGoEmojiUtils.RemoveAll(str)
emojiRemoved := emoji.RemoveAll(str)
assert.Equal(t, "武柳昊雨", emojiRemoved, "There should be no emoji")

}
}

0 comments on commit 2d1cb1f

Please sign in to comment.