MCPcopy Create free account
hub / github.com/coder/coder / TestHasPersistedInstructionFiles

Function TestHasPersistedInstructionFiles

coderd/x/chatd/chatd_internal_test.go:3660–3692  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3658}
3659
3660func TestHasPersistedInstructionFiles(t *testing.T) {
3661 t.Parallel()
3662
3663 t.Run("IgnoresAgentChatContextSentinel", func(t *testing.T) {
3664 t.Parallel()
3665 agentID := uuid.New()
3666 msgs := []database.ChatMessage{
3667 chattest.ChatMessageWithParts([]codersdk.ChatMessagePart{{
3668 Type: codersdk.ChatMessagePartTypeContextFile,
3669 ContextFilePath: AgentChatContextSentinelPath,
3670 ContextFileAgentID: uuid.NullUUID{
3671 UUID: agentID,
3672 Valid: true,
3673 },
3674 }}),
3675 }
3676 require.False(t, hasPersistedInstructionFiles(msgs))
3677 })
3678
3679 t.Run("AcceptsPersistedInstructionFile", func(t *testing.T) {
3680 t.Parallel()
3681 agentID := uuid.New()
3682 msgs := []database.ChatMessage{
3683 chattest.ChatMessageWithParts([]codersdk.ChatMessagePart{{
3684 Type: codersdk.ChatMessagePartTypeContextFile,
3685 ContextFilePath: "/workspace/AGENTS.md",
3686 ContextFileContent: "repo instructions",
3687 ContextFileAgentID: uuid.NullUUID{UUID: agentID, Valid: true},
3688 }}),
3689 }
3690 require.True(t, hasPersistedInstructionFiles(msgs))
3691 })
3692}
3693
3694func TestInstructionFromContextFilesUsesLatestContextAgent(t *testing.T) {
3695 t.Parallel()

Callers

nothing calls this directly

Calls 4

ChatMessageWithPartsFunction · 0.92
RunMethod · 0.65
NewMethod · 0.65

Tested by

no test coverage detected