Files
pipelines/internal/server/chat_turn_identity_test.go
T

26 lines
888 B
Go

package server
import (
"context"
"git.a-wan.net/alan/pipelines/internal/protocol"
"testing"
)
func TestLateHarnessCompletionCannotReleaseNextChatTurn(t *testing.T) {
h := newChatHub()
room := newChatRoom(context.Background(), "ses_turn")
defer room.cancel()
room.running = true
room.nativeTurnID = "new"
room.turnDone = make(chan struct{})
h.rooms[room.sessionID] = room
h.emitRoom(room, protocol.ChatEventFrame{SessionID: room.sessionID, Kind: protocol.ChatEventStep, Step: &protocol.ChatStep{Status: protocol.ChatStepEnded, TurnID: "old"}})
if !room.running {
t.Fatal("old terminal frame freed next turn queue")
}
h.emitRoom(room, protocol.ChatEventFrame{SessionID: room.sessionID, Kind: protocol.ChatEventStep, Step: &protocol.ChatStep{Status: protocol.ChatStepEnded, TurnID: "new"}})
if room.running {
t.Fatal("matching terminal frame did not finish turn")
}
}