refactor(tests): centralize DB query assertions with helpers

Reduce repetitive raw SQL in test bodies by routing scalar and multi-column checks through shared helpers, keeping test intent clearer without changing behavior.
This commit is contained in:
Antigravity
2026-02-17 06:02:46 +00:00
parent d82c099c7f
commit 3d1a8c8963
15 changed files with 288 additions and 419 deletions
@@ -30,11 +30,7 @@ func TestUserTunnelVisibleListContracts(t *testing.T) {
`, name, 1.0, 1, "tls", 99999, now, now, status, nil, inx).Error; err != nil {
t.Fatalf("insert tunnel %s: %v", name, err)
}
var id int64
if err := repo.DB().Raw("SELECT last_insert_rowid()").Row().Scan(&id); err != nil {
t.Fatalf("get tunnel id %s: %v", name, err)
}
return id
return mustLastInsertID(t, repo, name)
}
enabledA := insertTunnel("enabled-A", 1, 1)