aboutsummaryrefslogtreecommitdiffstats
path: root/server/server_test.go
diff options
context:
space:
mode:
authorElvis Claros Castro <elvis@claros.ar>2026-10-03 22:45:27 -0300
committerElvis Claros Castro <elvis@claros.ar>2026-10-03 22:45:27 -0300
commitf546a8a1578bef9fbc144580b84f51e3e90480b1 (patch)
tree5ef61bcbc9729878ced017429a7d21a644c82060 /server/server_test.go
parent5fc59b6936b2d4a05f5f5192458145d0112431d3 (diff)
downloadclaude-logbook-f546a8a1578bef9fbc144580b84f51e3e90480b1.tar.gz
claude-logbook-f546a8a1578bef9fbc144580b84f51e3e90480b1.zip
Show branches with their inherited history and mark directory changes
Diffstat (limited to 'server/server_test.go')
-rw-r--r--server/server_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/server/server_test.go b/server/server_test.go
index d19c5e8..1ad36ee 100644
--- a/server/server_test.go
+++ b/server/server_test.go
@@ -127,6 +127,24 @@ func TestCompactionBlock(t *testing.T) {
}
}
+func TestBranchAndDirectoryChange(t *testing.T) {
+ h := newHarness(t, nil)
+ branch := strings.Replace(session, `"c":[`, `"h":1,"o":"bbbbbbbb-0000","ot":"The original",`+
+ `"c":[{"r":"u","x":"old question"},{"r":"d","x":"/home/u/proj/sub"},`, 1)
+ r := h.create(`{"payload":` + payload(branch) + `}`)
+ txt := h.do("GET", "/share/"+r.ID+".txt", "", "").Body.String()
+ for _, want := range []string{"--- inherited history, from The original ---\n\n## User\n\nold question",
+ "--- the branch starts here ---\n\n> cd: /home/u/proj/sub\n"} {
+ if !strings.Contains(txt, want) {
+ t.Fatalf("missing %q in txt: %s", want, txt)
+ }
+ }
+ js := h.do("GET", "/share/"+r.ID+".json", "", "").Body.String()
+ if !strings.Contains(js, `"h":1,"o":"bbbbbbbb-0000","ot":"The original"`) {
+ t.Fatalf("json: %s", js)
+ }
+}
+
func TestUpdateAndDeleteNeedTheSecret(t *testing.T) {
h := newHarness(t, nil)
r := h.create(`{"payload":` + payload() + `}`)
@@ -187,6 +205,8 @@ func TestRejectsBadPayloads(t *testing.T) {
"two sessions": `{"payload":` + payload(session, session) + `}`,
"bad role": `{"payload":` + payload(strings.Replace(session, `"r":"t"`, `"r":"z"`, 1)) + `}`,
"bad type": `{"payload":` + payload(strings.Replace(session, `"u":1`, `"u":"1"`, 1)) + `}`,
+ "h too big": `{"payload":` + payload(strings.Replace(session, `"c":[`, `"h":9,"c":[`, 1)) + `}`,
+ "bad origin": `{"payload":` + payload(strings.Replace(session, `"c":[`, `"o":"../x","c":[`, 1)) + `}`,
"memories": `{"payload":{"s":[` + session + `],"m":[{"name":"x"}]}}`,
"bad expire": `{"payload":` + payload() + `,"expire":"never"}`,
"extra field": `{"payload":` + payload() + `,"html":"x"}`,