Conversation
6 tasks
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/8e0e24b3-80d6-49bb-a1ba-c5f77196960b Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve test quality for import cache tests
test(parser): improve import_cache_test.go quality per testify-expert criteria
May 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Improves the import cache test suite by isolating TestImportCache subtests, surfacing setup failures with require.NoError, and adding focused coverage for GetCacheDir and additional sanitizePath normalization cases.
Changes:
- Reworked
TestImportCachesubtests so each one builds its own cache instance instead of sharing mutable state. - Added explicit error assertions for
Set(...)calls that previously ignored setup failures. - Added a dedicated
TestGetCacheDirand two extraTestSanitizePathcases coveringfilepath.Cleannormalization behavior.
Show a summary per file
| File | Description |
|---|---|
pkg/parser/import_cache_test.go |
Tightens import cache unit-test isolation, adds direct GetCacheDir coverage, and extends sanitizePath test cases. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
Comment on lines
+75
to
+80
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| baseDir := tt.baseDir(t) | ||
| cache := NewImportCache(baseDir) | ||
| expected := filepath.Join(baseDir, ImportCacheDir) | ||
| assert.Equal(t, expected, cache.GetCacheDir(), "GetCacheDir should return base dir joined with ImportCacheDir") |
Collaborator
|
@copilot review all comments |
…tory Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd09043f-03ae-43d6-b09a-d48f37eab368 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TestImportCachesubtests shared a single cache instance and silently swallowedSeterrors, masking failures and creating inter-subtest dependencies.GetCacheDirlacked focused coverage, andTestSanitizePathwas missing coverage for commonfilepath.Cleannormalizations.Changes
TestImportCachesubtest now creates its ownNewImportCache(t.TempDir()), eliminating shared mutable statecachedPath, _ := cache.Set(...)now userequire.NoError, surfacing setup failures immediatelyGetCacheDircoverage — added a nested-base-dir subtest insideTestImportCacheDirectoryto cover the case where the base directory contains multiple path levels, without duplicating the existing assertionTestSanitizePathedge cases — two additional cases documentingfilepath.Cleanbehaviour:"./file.md"→"file.md"(leading dot-slash stripped)"a//b/file.md"→"a_b_file.md"(consecutive slashes collapsed)