package handler

import (
	"context"
	"net/http"
	"net/http/httptest"
	"testing"

	"aijianzhan/platform/internal/authx"
)

func TestAgentOwnsOnlineDBUsesContextAgent(t *testing.T) {
	// 无 Agents store 时必须安全返回 false
	r := httptest.NewRequest(http.MethodPost, "/", nil)
	ctx := authx.WithFullClaims(context.Background(), 2, 99, authx.Role智能体, 99, 0, []string{authx.Perm数据同步})
	r = r.WithContext(ctx)
	if agentOwnsOnlineDB(nil, r, 2, "ch1", "ch1_u3") {
		t.Fatal("expected false without svc")
	}
}
