Large manual tests corruption fix
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
//go:build test
|
||||
// +build test
|
||||
|
||||
package scheduling
|
||||
|
||||
// Package scheduling contains tests for working hours and availability endpoints.
|
||||
//
|
||||
// Test Coverage:
|
||||
@@ -14,12 +16,6 @@
|
||||
// - UpdateExceptionalApplications: PUT /api/scheduling/exceptional-applications - Apply holidays
|
||||
//
|
||||
// Authentication: Update/Create/Delete endpoints require admin role (403 for non-admins).
|
||||
package scheduling
|
||||
//go:build test
|
||||
// +build test
|
||||
|
||||
package scheduling
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
@@ -125,6 +121,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
// 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.
|
||||
func TestScheduling_GetDefaultHours(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -172,6 +169,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
// 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.
|
||||
func TestScheduling_UpdateDefaultHours_Admin(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -217,6 +215,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
|
||||
// TestScheduling_UpdateDefaultHours_NonAdmin verifies that non-admin users
|
||||
// receive HTTP 403 Forbidden when attempting to update default hours.
|
||||
func TestScheduling_UpdateDefaultHours_NonAdmin(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -244,6 +243,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
|
||||
// TestScheduling_ListExceptionalGroups verifies that admins can list all
|
||||
// exceptional working hours groups (holidays, special events).
|
||||
func TestScheduling_ListExceptionalGroups(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -281,6 +281,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
|
||||
// TestScheduling_CreateExceptionalGroup_Admin tests that an admin can
|
||||
// create a new exceptional working hours group with specific hours for each day.
|
||||
func TestScheduling_CreateExceptionalGroup_Admin(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -323,6 +324,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
|
||||
// TestScheduling_CreateExceptionalGroup_NonAdmin verifies that non-admin
|
||||
// users receive HTTP 403 when attempting to create exceptional groups.
|
||||
func TestScheduling_CreateExceptionalGroup_NonAdmin(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -355,6 +357,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
// 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.
|
||||
func TestScheduling_DeleteExceptionalGroup_Admin(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -395,6 +398,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
|
||||
// TestScheduling_DeleteExceptionalGroup_NonAdmin verifies that non-admin
|
||||
// users receive HTTP 403 when attempting to delete exceptional groups.
|
||||
func TestScheduling_DeleteExceptionalGroup_NonAdmin(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -416,6 +420,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
// 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.
|
||||
func TestScheduling_GetWorkingHours(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -451,6 +456,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
// TestScheduling_GetAvailableHours tests that available appointment
|
||||
// slots can be calculated for a date range based on working hours and service
|
||||
// durations.
|
||||
func TestScheduling_GetAvailableHours(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -488,6 +494,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
// TestScheduling_UpdateExceptionalApplications_Admin verifies that an
|
||||
// admin can apply an exceptional hours group to specific weeks, activating
|
||||
// holiday schedules for those periods.
|
||||
func TestScheduling_UpdateExceptionalApplications_Admin(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
@@ -532,6 +539,7 @@ func makeAuthRequest(handler http.Handler, method, path, token string, body inte
|
||||
|
||||
// TestScheduling_UpdateExceptionalApplications_NonAdmin verifies that
|
||||
// non-admin users receive HTTP 403 when attempting to apply exceptional hours.
|
||||
func TestScheduling_UpdateExceptionalApplications_NonAdmin(t *testing.T) {
|
||||
cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user