Files
ai_site/platform/internal/dbsync/dialect_test.go
whm b04b180d30 feat: harden loose-offline sync for user JWT, schema, and console ops
Enable Binding-scoped agent push/pull, empty-table schema ensure, SyncPage inspect/drop-table, default module import, and agent-bound publish docs from the 宇恒联调意见.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 09:47:35 +08:00

32 lines
840 B
Go

package dbsync
import "testing"
func TestNormalizeSQLiteDSN(t *testing.T) {
got := normalizeSQLiteDSN(`file:E:\data\remote.db`)
if got != "file:E:/data/remote.db?_pragma=busy_timeout(5000)" {
t.Fatalf("got %q", got)
}
got = normalizeSQLiteDSN(`E:\data\remote.db`)
if got != "file:E:/data/remote.db?_pragma=busy_timeout(5000)" {
t.Fatalf("bare path got %q", got)
}
got = normalizeSQLiteDSN(`file:E:/data/remote.db?_pragma=foreign_keys(1)`)
if got != "file:E:/data/remote.db?_pragma=foreign_keys(1)&_pragma=busy_timeout(5000)" {
t.Fatalf("keep query got %q", got)
}
}
func TestIsRetryable(t *testing.T) {
if !IsRetryable(Retryable("x")) {
t.Fatal("expected retryable")
}
if IsRetryable(fmtError("plain")) {
t.Fatal("plain should not")
}
}
type fmtError string
func (e fmtError) Error() string { return string(e) }