test: fix dm_scope lint findings

This commit is contained in:
xiwuqi 2026-03-25 03:12:53 -05:00
parent e6497e5324
commit 4471ff5f4f
2 changed files with 8 additions and 2 deletions

View file

@ -30,7 +30,12 @@ func TestNormalizeDMScope(t *testing.T) {
{name: "per peer", input: "per-peer", want: DMScopePerPeer, ok: true},
{name: "per channel peer", input: "per-channel-peer", want: DMScopePerChannelPeer, ok: true},
{name: "per channel alias", input: "per-channel", want: DMScopePerChannelPeer, ok: true},
{name: "per account channel peer", input: "per-account-channel-peer", want: DMScopePerAccountChannelPeer, ok: true},
{
name: "per account channel peer",
input: "per-account-channel-peer",
want: DMScopePerAccountChannelPeer,
ok: true,
},
{name: "unknown", input: "shared", want: "", ok: false},
}

View file

@ -6,6 +6,7 @@ import (
"net/http/httptest"
"os"
"path/filepath"
"strings"
"testing"
"github.com/sipeed/picoclaw/pkg/config"
@ -177,7 +178,7 @@ func TestValidateConfig_RejectsUnknownDMScope(t *testing.T) {
if len(errs) == 0 {
t.Fatal("validateConfig() errors = nil, want dm_scope validation error")
}
if !bytes.Contains([]byte(errs[0]), []byte("session.dm_scope")) {
if !strings.Contains(errs[0], "session.dm_scope") {
t.Fatalf("validateConfig() first error = %q, want dm_scope validation", errs[0])
}
}