Test docstrings

This commit is contained in:
2026-03-02 11:37:31 +00:00
parent b42b7f898a
commit 817d5dd021
11 changed files with 304 additions and 96 deletions
+14 -5
View File
@@ -27,7 +27,9 @@ import (
"crussell/mw"
)
func TestAdminServices_Create(t *testing.T) {
// TestAdminServices_Create verifies that an admin can create a new service
// with name, description, price, duration, and minimum age requirements. The new
// service is active by default and stored in the database.
cleanup := setupTestDB(t)
defer cleanup()
@@ -72,7 +74,8 @@ func TestAdminServices_Create(t *testing.T) {
}
}
func TestAdminServices_List(t *testing.T) {
// TestAdminServices_List tests that an admin can retrieve all services,
// including inactive ones. This is useful for managing the full service catalog.
cleanup := setupTestDB(t)
defer cleanup()
@@ -121,7 +124,9 @@ func TestAdminServices_List(t *testing.T) {
}
}
func TestAdminServices_Toggle(t *testing.T) {
// TestAdminServices_Toggle verifies that an admin can toggle a service's
// active status on/off. This is used to temporarily disable a service without
// deleting it from the system.
cleanup := setupTestDB(t)
defer cleanup()
@@ -169,7 +174,9 @@ func TestAdminServices_Toggle(t *testing.T) {
}
}
func TestAdminServices_Delete(t *testing.T) {
// TestAdminServices_Delete tests that an admin can soft-delete a service
// by setting is_active to false. The service record remains but is hidden from
// customers.
cleanup := setupTestDB(t)
defer cleanup()
@@ -202,7 +209,9 @@ func TestAdminServices_Delete(t *testing.T) {
}
}
func TestAdminServices_NonAdmin(t *testing.T) {
// TestAdminServices_NonAdmin verifies that non-admin users receive HTTP 403
// Forbidden when attempting to create, list, toggle, or delete services. This
// ensures proper role-based access control.
cleanup := setupTestDB(t)
defer cleanup()