test: fix dm_scope lint findings
This commit is contained in:
parent
e6497e5324
commit
4471ff5f4f
2 changed files with 8 additions and 2 deletions
|
|
@ -30,7 +30,12 @@ func TestNormalizeDMScope(t *testing.T) {
|
||||||
{name: "per peer", input: "per-peer", want: DMScopePerPeer, ok: true},
|
{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 peer", input: "per-channel-peer", want: DMScopePerChannelPeer, ok: true},
|
||||||
{name: "per channel alias", input: "per-channel", 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},
|
{name: "unknown", input: "shared", want: "", ok: false},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sipeed/picoclaw/pkg/config"
|
"github.com/sipeed/picoclaw/pkg/config"
|
||||||
|
|
@ -177,7 +178,7 @@ func TestValidateConfig_RejectsUnknownDMScope(t *testing.T) {
|
||||||
if len(errs) == 0 {
|
if len(errs) == 0 {
|
||||||
t.Fatal("validateConfig() errors = nil, want dm_scope validation error")
|
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])
|
t.Fatalf("validateConfig() first error = %q, want dm_scope validation", errs[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue