feat(feeds): add templated capture paths and inline modal
Build and publish container images / images (push) Successful in 11m2s
Build and publish container images / images (push) Successful in 11m2s
This commit is contained in:
1 parent
78da33d549
commit
a5f90f933d
12 files changed
+138
-11
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFeedCapturePreview(t *testing.T) {
|
||||
s, token, _, _, _ := feedFixture(t)
|
||||
for _, tt := range []struct {
|
||||
prefix string
|
||||
status int
|
||||
}{{"/notes/{YYYY}/{MM}/{DD}/{Subject}", 200}, {"/notes/{unknown}", 422}, {"/a/../b", 422}} {
|
||||
w := feedRequestTest(s, token, "POST", "capture-preview", map[string]string{"prefix": tt.prefix, "title": "日本語 / test"})
|
||||
if w.Code != tt.status {
|
||||
t.Fatal(w.Code, w.Body)
|
||||
}
|
||||
if w.Code == 200 {
|
||||
var data map[string]string
|
||||
if e := json.Unmarshal(w.Body.Bytes(), &data); e != nil || strings.ContainsAny(data["prefix"], "{}") || !strings.HasSuffix(data["prefix"], "/日本語---test") {
|
||||
t.Fatal(data, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
if w := feedRequestTest(s, "", "POST", "capture-preview", map[string]string{"prefix": "/notes"}); w.Code != 401 {
|
||||
t.Fatal(w.Code)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user