Add tests for main package, manager, and various components
- Introduced unit tests for the main package to ensure compilation. - Added tests for the manager, including validation of upload sessions and handling of Blender binary paths. - Implemented tests for job token generation and validation, ensuring security and integrity. - Created tests for configuration management and database schema to verify functionality. - Added tests for logger and runner components to enhance overall test coverage and reliability.
This commit is contained in:
21
internal/manager/runners_test.go
Normal file
21
internal/manager/runners_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package api
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseBlenderFrame(t *testing.T) {
|
||||
frame, ok := parseBlenderFrame("Info Fra:2470 Mem:12.00M")
|
||||
if !ok || frame != 2470 {
|
||||
t.Fatalf("parseBlenderFrame() = (%d,%v), want (2470,true)", frame, ok)
|
||||
}
|
||||
if _, ok := parseBlenderFrame("no frame here"); ok {
|
||||
t.Fatal("expected parse to fail for non-frame text")
|
||||
}
|
||||
}
|
||||
|
||||
func TestJobTaskCounts_Progress(t *testing.T) {
|
||||
c := &jobTaskCounts{total: 10, completed: 4}
|
||||
if got := c.progress(); got != 40 {
|
||||
t.Fatalf("progress() = %v, want 40", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user