- Removed Node.js build artifacts from .gitignore and adjusted Makefile to reflect changes in web UI build process, now using server-rendered Go templates instead of React. - Updated README to clarify the new web UI architecture and output formats, emphasizing the removal of the Node.js build step. - Added a command to set the number of frames per render task in manager configuration, enhancing user control over rendering settings. - Improved Gitea workflow by removing unnecessary npm install step, streamlining the CI process.
38 lines
921 B
Go
38 lines
921 B
Go
package api
|
|
|
|
import (
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestParseBoolForm(t *testing.T) {
|
|
req := httptest.NewRequest("POST", "/?flag=true", nil)
|
|
req.ParseForm()
|
|
req.Form.Set("enabled", "true")
|
|
if !parseBoolForm(req, "enabled") {
|
|
t.Fatalf("expected true for enabled=true")
|
|
}
|
|
|
|
req.Form.Set("enabled", "no")
|
|
if parseBoolForm(req, "enabled") {
|
|
t.Fatalf("expected false for enabled=no")
|
|
}
|
|
}
|
|
|
|
func TestParseIntQuery(t *testing.T) {
|
|
req := httptest.NewRequest("GET", "/?limit=42", nil)
|
|
if got := parseIntQuery(req, "limit", 10); got != 42 {
|
|
t.Fatalf("expected 42, got %d", got)
|
|
}
|
|
|
|
req = httptest.NewRequest("GET", "/?limit=-1", nil)
|
|
if got := parseIntQuery(req, "limit", 10); got != 10 {
|
|
t.Fatalf("expected fallback 10, got %d", got)
|
|
}
|
|
|
|
req = httptest.NewRequest("GET", "/?limit=abc", nil)
|
|
if got := parseIntQuery(req, "limit", 10); got != 10 {
|
|
t.Fatalf("expected fallback 10, got %d", got)
|
|
}
|
|
}
|