(t *testing.T)
| 3658 | } |
| 3659 | |
| 3660 | func 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 | |
| 3694 | func TestInstructionFromContextFilesUsesLatestContextAgent(t *testing.T) { |
| 3695 | t.Parallel() |
nothing calls this directly
no test coverage detected