// Copyright (C) 2026 Yota Hamada
// SPDX-License-Identifier: GPL-3.0-or-later

package agent

import (
	"encoding/json"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestThinkTool_Run(t *testing.T) {
	t.Parallel()

	tool := NewThinkTool()

	tests := []struct {
		name         string
		input        string
		wantContains string
	}{
		{
			name:         "returns acknowledgment",
			input:        `{"thought": "Let me think about this..."}`,
			wantContains: "Thought recorded",
		},
		{
			name:  "works with empty thought",
			input: `{"thought": ""}`,
		},
		{
			name:  "works with empty input",
			input: `{}`,
		},
	}

	for _, tc := range tests {
		t.Run(tc.name, func(t *testing.T) {
			t.Parallel()

			result := tool.Run(ToolContext{}, json.RawMessage(tc.input))

			assert.False(t, result.IsError)
			if tc.wantContains != "" {
				assert.Contains(t, result.Content, tc.wantContains)
			}
		})
	}
}
