22 lines
576 B
Go
22 lines
576 B
Go
|
|
package app
|
||
|
|
|
||
|
|
import (
|
||
|
|
"reflect"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestAttachKolGenerationKnowledgeScopeMatchesWorkerContract(t *testing.T) {
|
||
|
|
taskInput := map[string]any{
|
||
|
|
"rendered_prompt": "write an article",
|
||
|
|
}
|
||
|
|
|
||
|
|
attachKolGenerationKnowledgeScope(taskInput, 4, []int64{47, 17, 47, 0})
|
||
|
|
|
||
|
|
if got := int64(extractInt(taskInput, "brand_id")); got != 4 {
|
||
|
|
t.Fatalf("worker brand_id = %d, want 4", got)
|
||
|
|
}
|
||
|
|
if got := extractKnowledgeGroupIDs(taskInput["knowledge_group_ids"]); !reflect.DeepEqual(got, []int64{17, 47}) {
|
||
|
|
t.Fatalf("worker knowledge_group_ids = %#v, want [17 47]", got)
|
||
|
|
}
|
||
|
|
}
|