- Add unit tests for MediaScanner.GetPollInterval and GetAutoScanEnabled - Add integration tests for scan-settings API endpoints - Update validation test cases to use seconds (1-3600) instead of minutes - Fix worker.go to use new NewMediaScanner signature
27 lines
597 B
Go
27 lines
597 B
Go
package services
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestMediaScanner_GetPollInterval(t *testing.T) {
|
|
t.Run("nil db returns default", func(t *testing.T) {
|
|
scanner := &MediaScanner{db: nil}
|
|
interval := scanner.GetPollInterval()
|
|
if interval != 30*time.Second {
|
|
t.Errorf("expected 30s, got %v", interval)
|
|
}
|
|
})
|
|
}
|
|
|
|
func TestMediaScanner_GetAutoScanEnabled(t *testing.T) {
|
|
t.Run("nil db returns default true", func(t *testing.T) {
|
|
scanner := &MediaScanner{db: nil}
|
|
enabled := scanner.GetAutoScanEnabled()
|
|
if enabled != true {
|
|
t.Errorf("expected true, got %v", enabled)
|
|
}
|
|
})
|
|
}
|