Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestScanIntish(t *testing.T) {
|
||||
cases := []struct {
|
||||
in any
|
||||
want int
|
||||
}{
|
||||
{int64(42), 42},
|
||||
{float64(3.9), 3},
|
||||
{[]byte("12.50"), 12},
|
||||
{"7", 7},
|
||||
{nil, 0},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
if got := scanIntish(tc.in); got != tc.want {
|
||||
t.Fatalf("scanIntish(%v)=%d want %d", tc.in, got, tc.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSummarizeOrphans(t *testing.T) {
|
||||
s := summarizeOrphans([]OrphanFinding{
|
||||
{Check: "a", Pass: true},
|
||||
{Check: "b", Pass: false},
|
||||
{Check: "platform_admins", Pass: true, Count: 2},
|
||||
{Check: "skipped_dry_run", Pass: true},
|
||||
})
|
||||
if s.Passed != 3 || s.Failed != 1 || s.Total != 4 {
|
||||
t.Fatalf("summary %#v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMysqlSelectList(t *testing.T) {
|
||||
got := mysqlSelectList("id", "COALESCE(name, id)", "'en'")
|
||||
want := "SELECT id, COALESCE(name, id), 'en'"
|
||||
if got != want {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user