(t *testing.T)
| 373 | } |
| 374 | |
| 375 | func TestImportCacheSetIdempotent(t *testing.T) { |
| 376 | tempDir := t.TempDir() |
| 377 | cache := NewImportCache(tempDir) |
| 378 | |
| 379 | firstContent := []byte("first content") |
| 380 | secondContent := []byte("second content") |
| 381 | |
| 382 | path1, err := cache.Set("owner", "repo", "test.md", "sha1", firstContent) |
| 383 | require.NoError(t, err, "first Set should succeed") |
| 384 | |
| 385 | path2, err := cache.Set("owner", "repo", "test.md", "sha1", secondContent) |
| 386 | require.NoError(t, err, "second Set with same key should succeed (overwrite)") |
| 387 | assert.Equal(t, path1, path2, "both Set calls should return the same cache path") |
| 388 | |
| 389 | content, err := os.ReadFile(path2) |
| 390 | require.NoError(t, err, "reading overwritten file should succeed") |
| 391 | assert.Equal(t, string(secondContent), string(content), "file should contain second (latest) content") |
| 392 | } |
| 393 | |
| 394 | func TestImportCacheGetDoesNotValidateComponents(t *testing.T) { |
| 395 | // Document that Get does not validate components (unlike Set). |
nothing calls this directly
no test coverage detected