| 1 | package agent |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestRecoveryFilenameParentAndRoot(t *testing.T) { |
| 6 | t.Parallel() |
| 7 | parent, ok := RecoveryFilenameParentID("/tmp/session-recovery-aabbccddeeff0011.jsonl") |
| 8 | if !ok || parent != "session" { |
| 9 | t.Fatalf("parent = %q ok=%v", parent, ok) |
| 10 | } |
| 11 | root, ok := RecoveryFilenameRootID("/tmp/session-recovery-aabbccddeeff0011.jsonl") |
| 12 | if !ok || root != "session" { |
| 13 | t.Fatalf("root = %q ok=%v", root, ok) |
| 14 | } |
| 15 | if LooksLikeRecoveryFilename("/tmp/session.jsonl") { |
| 16 | t.Fatal("plain session should not match") |
| 17 | } |
| 18 | if !LooksLikeRecoveryFilename("/tmp/session-recovery-AABBCCDDEEFF0011.jsonl") { |
| 19 | t.Fatal("uppercase hex should match") |
| 20 | } |
| 21 | } |
| 22 |