mirror of
https://github.com/1f349/site-hosting.git
synced 2025-04-15 16:07:46 +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")
|
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) {
|
t.Run("switch to "+branch+" branch", func(t *testing.T) {
|
||||||
h := New(afero.NewMemMapFs(), &fakeServeDB{})
|
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()
|
rec := httptest.NewRecorder()
|
||||||
h.ServeHTTP(rec, req)
|
h.ServeHTTP(rec, req)
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ func TestHandler_ServeHTTP(t *testing.T) {
|
|||||||
assert.Equal(t, cookies[0].SameSite, http.SameSiteLaxMode)
|
assert.Equal(t, cookies[0].SameSite, http.SameSiteLaxMode)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func serveTest(t *testing.T, address string, branch string, name string) {
|
func serveTest(t *testing.T, address string, branch string, name string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user