mirror of
https://github.com/1f349/site-hosting.git
synced 2025-04-13 23:26:02 +01:00
Test switching branch on paths
This commit is contained in:
parent
912f1b2e03
commit
ccfac033df
@ -45,10 +45,11 @@ func TestHandler_ServeHTTP(t *testing.T) {
|
||||
serveTest(t, "example.com/hello-world", branch, "example.com/@"+branch+"/hello-world")
|
||||
})
|
||||
|
||||
for _, testPath := range []string{"/", "/posts/test", "/this-is-definitely-a-page-that-I-really-need-to-view-right-now"} {
|
||||
t.Run("switch to "+branch+" branch", func(t *testing.T) {
|
||||
h := New(afero.NewMemMapFs(), &fakeServeDB{})
|
||||
|
||||
req := httptest.NewRequest(http.MethodGet, httpPrefix+"example.com/?__bluebell-switch-beta="+branch, nil)
|
||||
req := httptest.NewRequest(http.MethodGet, httpPrefix+"example.com"+testPath+"?__bluebell-switch-beta="+branch, nil)
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, req)
|
||||
|
||||
@ -70,6 +71,7 @@ func TestHandler_ServeHTTP(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func serveTest(t *testing.T, address string, branch string, name string) {
|
||||
t.Run(fmt.Sprintf("serveTest \"%s\" (%s) -> \"%s\"", address, branch, name), func(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user