2021-03-04 03:04:52 +01:00
|
|
|
|
package namer
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Test_getClaimNameFromTitle(t *testing.T) {
|
|
|
|
|
name := getClaimNameFromTitle("СтопХам - \"В ожидании ответа\"", 0)
|
2021-03-15 22:50:23 +01:00
|
|
|
|
assert.Equal(t, "стопхам-в-ожидании", name)
|
2021-03-04 03:04:52 +01:00
|
|
|
|
name = getClaimNameFromTitle("SADB - \"A Weak Woman With a Strong Hood\"", 0)
|
2021-03-15 22:50:23 +01:00
|
|
|
|
assert.Equal(t, "sadb-a-weak-woman-with-a-strong-hood", name)
|
2021-03-04 03:04:52 +01:00
|
|
|
|
name = getClaimNameFromTitle("錢包整理術 5 Tips、哪種錢包最NG?|有錢人默默在做的「錢包整理術」 ft.@SHIN LI", 0)
|
2021-03-15 22:50:23 +01:00
|
|
|
|
assert.Equal(t, "錢包整理術-5-tips、哪種錢包最", name)
|
|
|
|
|
name = getClaimNameFromTitle("اسرع-طريقة-لتختيم", 0)
|
|
|
|
|
assert.Equal(t, "اسرع-طريقة-لتختيم", name)
|
|
|
|
|
name = getClaimNameFromTitle("شكرا على 380 مشترك😍😍😍😍 لي يريد دعم ادا وصلنا المقطع 40 لايك وراح ادعم قناتين", 0)
|
|
|
|
|
assert.Equal(t, "شكرا-على-380-مشترك😍😍\xf0\x9f", name)
|
|
|
|
|
name = getClaimNameFromTitle("test-@", 0)
|
|
|
|
|
assert.Equal(t, "test", name)
|
|
|
|
|
name = getClaimNameFromTitle("『あなたはただの空の殻でした』", 0)
|
|
|
|
|
assert.Equal(t, "『あなたはただの空の殻でした』", name)
|
2021-03-17 16:40:37 +01:00
|
|
|
|
name = getClaimNameFromTitle("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 50)
|
|
|
|
|
assert.Equal(t, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-50", name)
|
2021-03-04 03:04:52 +01:00
|
|
|
|
}
|