refactor(routing): 暴露 system_locked_domains + 服务端 follow-up 清理(FK/Validate/dedup/exclude单源/共用Store/Builtin保留)
This commit is contained in:
@@ -32,6 +32,27 @@ func seedU(t *testing.T, db *sql.DB, id int64, uuid string) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestSQLiteRoutingStoreGetNoProfileRow isolates the "queried the DB, found
|
||||
// no row" path from TestSQLiteRoutingStoreUpsertGet's combined
|
||||
// empty→upsert→overwrite flow: a store backed by a real (non-nil) *sql.DB,
|
||||
// with the user seeded but no routing_profiles row for them, must return
|
||||
// (nil, nil) — not an error — via the sql.ErrNoRows branch in Store.Get.
|
||||
func TestSQLiteRoutingStoreGetNoProfileRow(t *testing.T) {
|
||||
db := openDB(t)
|
||||
seedU(t, db, 2, "u2")
|
||||
st := NewStore(db)
|
||||
if st == nil {
|
||||
t.Fatal("NewStore returned nil")
|
||||
}
|
||||
got, err := st.Get(context.Background(), 2)
|
||||
if err != nil {
|
||||
t.Fatalf("want nil error for no-rows, got %v", err)
|
||||
}
|
||||
if got != nil {
|
||||
t.Fatalf("want nil profile for seeded user with no profile row, got %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSQLiteRoutingStoreUpsertGet(t *testing.T) {
|
||||
db := openDB(t) // 内存库 + MigrateUp(sqlite)
|
||||
seedU(t, db, 1, "u1")
|
||||
|
||||
Reference in New Issue
Block a user