b743639731
- Introduced a new package `seedlang` to handle language parsing and constants for English and Chinese. - Updated `Init` functions across various modules (kb, quickreply, skill, tag) to accept a language parameter. - Implemented English seed data for FAQs, quick replies, skills, and tags, ensuring no Chinese text is present in English data. - Added tests to verify that English seed data does not contain Chinese characters. - Removed outdated README file from the kb test data directory. - Created new test files for channel and kb to validate the absence of Chinese text in English seed data.
29 lines
758 B
Go
29 lines
758 B
Go
package quickreply
|
|
|
|
import (
|
|
"agent-desk/cmd/testdata/seedlang"
|
|
"regexp"
|
|
"testing"
|
|
)
|
|
|
|
var hanTextPattern = regexp.MustCompile(`\p{Han}`)
|
|
|
|
func TestEnglishSeedItemsMatchChineseCount(t *testing.T) {
|
|
englishItems := seedItems(seedlang.English)
|
|
chineseItems := seedItems(seedlang.Chinese)
|
|
|
|
if len(englishItems) != len(chineseItems) {
|
|
t.Fatalf("english seed count = %d, want %d", len(englishItems), len(chineseItems))
|
|
}
|
|
}
|
|
|
|
func TestEnglishSeedItemsDoNotContainChineseText(t *testing.T) {
|
|
for _, item := range seedItems(seedlang.English) {
|
|
for _, value := range []string{item.groupName, item.title, item.content} {
|
|
if hanTextPattern.MatchString(value) {
|
|
t.Fatalf("english quick reply %d contains Chinese text: %q", item.id, value)
|
|
}
|
|
}
|
|
}
|
|
}
|