MCPcopy Create free account
hub / github.com/github/gh-aw / TestImportCacheMissingFile

Function TestImportCacheMissingFile

pkg/parser/import_cache_test.go:97–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestImportCacheMissingFile(t *testing.T) {
98 tempDir := t.TempDir()
99
100 cache := NewImportCache(tempDir)
101
102 // Add entry to cache
103 testContent := []byte("test")
104 cachedPath, err := cache.Set("owner", "repo", "test.md", "sha1", testContent)
105 require.NoError(t, err, "Set should succeed for valid inputs")
106
107 // Delete the cached file
108 err = os.Remove(cachedPath)
109 require.NoError(t, err, "removing cached file should succeed")
110
111 // Try to get the entry - should return not found since file is missing
112 _, found := cache.Get("owner", "repo", "test.md", "sha1")
113 assert.False(t, found, "Get should return cache miss when backing file has been deleted")
114}
115
116func TestImportCacheEmptyCache(t *testing.T) {
117 tempDir := t.TempDir()

Callers

nothing calls this directly

Calls 3

SetMethod · 0.95
GetMethod · 0.95
NewImportCacheFunction · 0.85

Tested by

no test coverage detected