[🤖] Add Unit-Tests
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m34s

This commit is contained in:
2026-04-27 10:46:08 +02:00
parent dad0e3240d
commit 02d6894ec6
116 changed files with 18795 additions and 1 deletions
+33
View File
@@ -0,0 +1,33 @@
package ginext
import (
"net/http"
"testing"
)
func TestRedirectFound(t *testing.T) {
hf := RedirectFound("/x")
resp := hf(PreContext{})
if resp == nil {
t.Fatalf("expected response")
}
if resp.(InspectableHTTPResponse).Statuscode() != http.StatusFound {
t.Fatalf("expected 302")
}
}
func TestRedirectTemporary(t *testing.T) {
hf := RedirectTemporary("/x")
resp := hf(PreContext{})
if resp.(InspectableHTTPResponse).Statuscode() != http.StatusTemporaryRedirect {
t.Fatalf("expected 307")
}
}
func TestRedirectPermanent(t *testing.T) {
hf := RedirectPermanent("/x")
resp := hf(PreContext{})
if resp.(InspectableHTTPResponse).Statuscode() != http.StatusPermanentRedirect {
t.Fatalf("expected 308")
}
}