add test for SetSessionID preamble update
This commit is contained in:
parent
09a9364b6f
commit
82df12e293
|
|
@ -1705,6 +1705,33 @@ func TestSetSessionID_Rename(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSetSessionID_UpdatesPreamble(t *testing.T) {
|
||||
oldID := NewSessionID()
|
||||
env := AgentEnv{
|
||||
preamble: "session is " + oldID + " end",
|
||||
}
|
||||
c := NewAgentCore(AgentCoreConfig{
|
||||
Backend: defaultBE(),
|
||||
AgentName: "test",
|
||||
AgentsDir: t.TempDir(),
|
||||
SessionsDir: t.TempDir(),
|
||||
SessionID: oldID,
|
||||
CWD: t.TempDir(),
|
||||
Env: env,
|
||||
NewDispatcher: tools.NewDispatcher,
|
||||
}).(*agent)
|
||||
t.Cleanup(c.Close)
|
||||
|
||||
newID := NewSessionID()
|
||||
if err := c.SetSessionID(newID); err != nil {
|
||||
t.Fatalf("SetSessionID: %v", err)
|
||||
}
|
||||
want := "session is " + newID + " end"
|
||||
if got := c.SystemPrompt(); got != want {
|
||||
t.Errorf("SystemPrompt() = %q; want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetSessionID_SameID(t *testing.T) {
|
||||
c := newCore(t, nil, nil)
|
||||
id := c.sessionID
|
||||
|
|
|
|||
Reference in New Issue