16 lines
513 B
Go
16 lines
513 B
Go
package httpapi
|
|||
|
|
|
||
|
|
import "testing"
|
||
|
|
|
||
|
|
func TestSubjectCreateAllowsEmptyOptionalContext(t *testing.T) {
|
||
|
|
for _, value := range []string{"", " "} {
|
||
|
|
fields := validateSubject("长者", "zh-CN", "Asia/Shanghai",
|
||
|
|
map[string]any{"background": value, "interests": []any{}},
|
||
|
|
map[string]any{"conversation_goal": value, "pace": "slow", "preferred_topics": []any{}, "avoided_topics": []any{}},
|
||
|
|
)
|
||
|
|
if len(fields) != 0 {
|
||
|
|
t.Fatalf("optional background and goal %q should be accepted: %#v", value, fields)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|