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
+30 -12
View File
@@ -122,7 +122,9 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
// --- Tests for GetDefaultHours ---
func TestScheduling_GetDefaultHours(t *testing.T) {
// TestScheduling_GetDefaultHours verifies that the default weekly working hours
// can be retrieved. The test checks that all 7 days are returned with correct
// opening times, closing times, and is_open status.
cleanup := setupTestDB(t)
defer cleanup()
@@ -167,7 +169,9 @@ func TestScheduling_GetDefaultHours(t *testing.T) {
// --- Tests for UpdateDefaultHours ---
func TestScheduling_UpdateDefaultHours_Admin(t *testing.T) {
// TestScheduling_UpdateDefaultHours_Admin tests that an admin can update
// the default weekly working hours. The new schedule is persisted to the
// database and returned on subsequent requests.
cleanup := setupTestDB(t)
defer cleanup()
@@ -211,7 +215,8 @@ func TestScheduling_UpdateDefaultHours_Admin(t *testing.T) {
}
}
func TestScheduling_UpdateDefaultHours_NonAdmin(t *testing.T) {
// TestScheduling_UpdateDefaultHours_NonAdmin verifies that non-admin users
// receive HTTP 403 Forbidden when attempting to update default hours.
cleanup := setupTestDB(t)
defer cleanup()
@@ -237,7 +242,8 @@ func TestScheduling_UpdateDefaultHours_NonAdmin(t *testing.T) {
// --- Tests for ListExceptionalGroups ---
func TestScheduling_ListExceptionalGroups(t *testing.T) {
// TestScheduling_ListExceptionalGroups verifies that admins can list all
// exceptional working hours groups (holidays, special events).
cleanup := setupTestDB(t)
defer cleanup()
@@ -273,7 +279,8 @@ func TestScheduling_ListExceptionalGroups(t *testing.T) {
// --- Tests for CreateExceptionalGroup ---
func TestScheduling_CreateExceptionalGroup_Admin(t *testing.T) {
// TestScheduling_CreateExceptionalGroup_Admin tests that an admin can
// create a new exceptional working hours group with specific hours for each day.
cleanup := setupTestDB(t)
defer cleanup()
@@ -314,7 +321,8 @@ func TestScheduling_CreateExceptionalGroup_Admin(t *testing.T) {
}
}
func TestScheduling_CreateExceptionalGroup_NonAdmin(t *testing.T) {
// TestScheduling_CreateExceptionalGroup_NonAdmin verifies that non-admin
// users receive HTTP 403 when attempting to create exceptional groups.
cleanup := setupTestDB(t)
defer cleanup()
@@ -344,7 +352,9 @@ func TestScheduling_CreateExceptionalGroup_NonAdmin(t *testing.T) {
// --- Tests for DeleteExceptionalGroup ---
func TestScheduling_DeleteExceptionalGroup_Admin(t *testing.T) {
// TestScheduling_DeleteExceptionalGroup_Admin tests that an admin can delete
// an exceptional working hours group. This removes the group and its associated
// hours from the system.
cleanup := setupTestDB(t)
defer cleanup()
@@ -383,7 +393,8 @@ func TestScheduling_DeleteExceptionalGroup_Admin(t *testing.T) {
}
}
func TestScheduling_DeleteExceptionalGroup_NonAdmin(t *testing.T) {
// TestScheduling_DeleteExceptionalGroup_NonAdmin verifies that non-admin
// users receive HTTP 403 when attempting to delete exceptional groups.
cleanup := setupTestDB(t)
defer cleanup()
@@ -402,7 +413,9 @@ func TestScheduling_DeleteExceptionalGroup_NonAdmin(t *testing.T) {
// --- Tests for GetWorkingHours ---
func TestScheduling_GetWorkingHours(t *testing.T) {
// TestScheduling_GetWorkingHours verifies that working hours can be
// retrieved for a given date range. The response includes whether hours come
// from default schedule or exceptional groups.
cleanup := setupTestDB(t)
defer cleanup()
@@ -435,7 +448,9 @@ func TestScheduling_GetWorkingHours(t *testing.T) {
// --- Tests for GetAvailableHours ---
func TestScheduling_GetAvailableHours(t *testing.T) {
// TestScheduling_GetAvailableHours tests that available appointment
// slots can be calculated for a date range based on working hours and service
// durations.
cleanup := setupTestDB(t)
defer cleanup()
@@ -470,7 +485,9 @@ func TestScheduling_GetAvailableHours(t *testing.T) {
// --- Tests for UpdateExceptionalApplications ---
func TestScheduling_UpdateExceptionalApplications_Admin(t *testing.T) {
// TestScheduling_UpdateExceptionalApplications_Admin verifies that an
// admin can apply an exceptional hours group to specific weeks, activating
// holiday schedules for those periods.
cleanup := setupTestDB(t)
defer cleanup()
@@ -513,7 +530,8 @@ func TestScheduling_UpdateExceptionalApplications_Admin(t *testing.T) {
}
}
func TestScheduling_UpdateExceptionalApplications_NonAdmin(t *testing.T) {
// TestScheduling_UpdateExceptionalApplications_NonAdmin verifies that
// non-admin users receive HTTP 403 when attempting to apply exceptional hours.
cleanup := setupTestDB(t)
defer cleanup()