MCPcopy Create free account
hub / github.com/diillson/chatcli / TestCacheInvalidation

Function TestCacheInvalidation

cli/workspace/bootstrap_test.go:73–92  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func TestCacheInvalidation(t *testing.T) {
74 dir := t.TempDir()
75 path := filepath.Join(dir, "SOUL.md")
76 _ = os.WriteFile(path, []byte("v1"), 0o644)
77
78 bl := NewBootstrapLoader(dir, "", testLogger())
79 c1, _ := bl.LoadFile("SOUL.md")
80 if c1 != "v1" {
81 t.Fatalf("expected 'v1', got %q", c1)
82 }
83
84 // Modify file (need to wait for mtime to change)
85 time.Sleep(10 * time.Millisecond)
86 _ = os.WriteFile(path, []byte("v2"), 0o644)
87
88 c2, _ := bl.LoadFile("SOUL.md")
89 if c2 != "v2" {
90 t.Errorf("expected 'v2' after modification, got %q", c2)
91 }
92}
93
94func TestIsStale(t *testing.T) {
95 dir := t.TempDir()

Callers

nothing calls this directly

Calls 4

LoadFileMethod · 0.95
NewBootstrapLoaderFunction · 0.85
ErrorfMethod · 0.80
testLoggerFunction · 0.70

Tested by

no test coverage detected