Remove markdown test docs and document tests inline
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestAddRegistersRepoAndEntry verifies add persists a new entry and registers its repo.
|
||||
func TestAddRegistersRepoAndEntry(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
initGitRepo(t, fixture.RepoPath)
|
||||
@@ -42,6 +43,7 @@ func TestAddRegistersRepoAndEntry(t *testing.T) {
|
||||
assertContains(t, listOut, "Plan 内嵌任务结构,不是独立表")
|
||||
}
|
||||
|
||||
// TestAddUpdatesExistingEntryOnSameKindAndKey verifies add upserts an existing entry when kind and key match.
|
||||
func TestAddUpdatesExistingEntryOnSameKindAndKey(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -92,6 +94,7 @@ func TestAddUpdatesExistingEntryOnSameKindAndKey(t *testing.T) {
|
||||
assertContains(t, listOut, "修订后的摘要")
|
||||
}
|
||||
|
||||
// TestAddFailedValidationStillRegistersRepo verifies add still records the repo when validation fails.
|
||||
func TestAddFailedValidationStillRegistersRepo(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
initGitRepo(t, fixture.RepoPath)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestEventsReadsHistoryByID verifies events returns newest-first history for an entry ID.
|
||||
func TestEventsReadsHistoryByID(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -43,6 +44,7 @@ func TestEventsReadsHistoryByID(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestEventsResolvesEntryByRepoKindKey verifies events resolves an entry from the repo-kind-key selector.
|
||||
func TestEventsResolvesEntryByRepoKindKey(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -70,6 +72,7 @@ func TestEventsResolvesEntryByRepoKindKey(t *testing.T) {
|
||||
assertContains(t, eventsOut, "created (- -> confirmed)")
|
||||
}
|
||||
|
||||
// TestEventsRejectsMissingEntrySelector verifies events requires either an ID or repo-kind-key selector.
|
||||
func TestEventsRejectsMissingEntrySelector(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestRepoMemoryRootHelpShowsWorkflowAndCommands verifies root help describes the workflow and available commands.
|
||||
func TestRepoMemoryRootHelpShowsWorkflowAndCommands(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -25,6 +26,7 @@ func TestRepoMemoryRootHelpShowsWorkflowAndCommands(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRepoMemoryCommandHelpWorksThroughHelpSubcommand verifies the help subcommand renders command-specific help.
|
||||
func TestRepoMemoryCommandHelpWorksThroughHelpSubcommand(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -45,6 +47,7 @@ func TestRepoMemoryCommandHelpWorksThroughHelpSubcommand(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRepoMemoryCommandHelpWorksWithDashHelp verifies --help renders command-specific help.
|
||||
func TestRepoMemoryCommandHelpWorksWithDashHelp(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestIngestImportsDocsAIMarkdown verifies ingest imports docs ai markdown.
|
||||
func TestIngestImportsDocsAIMarkdown(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -31,6 +32,7 @@ func TestIngestImportsDocsAIMarkdown(t *testing.T) {
|
||||
mustContain(t, listOut, "danger:repo-memory:danger-zones [confirmed]")
|
||||
}
|
||||
|
||||
// TestIngestRejectsWhenNoMarkdownFound verifies ingest rejects when no markdown found.
|
||||
func TestIngestRejectsWhenNoMarkdownFound(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -52,6 +54,7 @@ func TestIngestRejectsWhenNoMarkdownFound(t *testing.T) {
|
||||
mustContain(t, stderr, "no markdown files found under "+filepath.Join(fixture.RepoPath, "docs", "ai"))
|
||||
}
|
||||
|
||||
// TestIngestImportsHeadinglessMarkdownAsSingleEntry verifies ingest imports headingless markdown as single entry.
|
||||
func TestIngestImportsHeadinglessMarkdownAsSingleEntry(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestInitCreatesSchemaOnEmptyDB verifies init creates a new database schema.
|
||||
func TestInitCreatesSchemaOnEmptyDB(t *testing.T) {
|
||||
dbPath := filepath.Join(t.TempDir(), "repo-memory.db")
|
||||
|
||||
@@ -19,6 +20,7 @@ func TestInitCreatesSchemaOnEmptyDB(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestInitIsIdempotentOnExistingDB verifies init can be rerun on an existing database.
|
||||
func TestInitIsIdempotentOnExistingDB(t *testing.T) {
|
||||
dbPath := filepath.Join(t.TempDir(), "repo-memory.db")
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestLinkCreatesRelationBetweenEntries verifies link creates relation between entries.
|
||||
func TestLinkCreatesRelationBetweenEntries(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -43,6 +44,7 @@ func TestLinkCreatesRelationBetweenEntries(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestLinkRejectsMissingRelation verifies link rejects missing relation.
|
||||
func TestLinkRejectsMissingRelation(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -79,6 +81,7 @@ func TestLinkRejectsMissingRelation(t *testing.T) {
|
||||
assertContains(t, stderr, "relation is required")
|
||||
}
|
||||
|
||||
// TestLinkRejectsWhenEntryIDMissing verifies link rejects when entry ID missing.
|
||||
func TestLinkRejectsWhenEntryIDMissing(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestListFiltersByKindAndStatus verifies list filters by kind and status.
|
||||
func TestListFiltersByKindAndStatus(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -57,6 +58,7 @@ func TestListFiltersByKindAndStatus(t *testing.T) {
|
||||
mustNotContain(t, listOut, "chain:ai-insight.get")
|
||||
}
|
||||
|
||||
// TestListReturnsNoEntriesWhenEmpty verifies list returns no entries when empty.
|
||||
func TestListReturnsNoEntriesWhenEmpty(t *testing.T) {
|
||||
fixture := initRepoMemoryTestDB(t)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"ai-workflow-skill/packages/repo-memory-runtime/internal/store"
|
||||
)
|
||||
|
||||
// TestVerifyCandidateDetectsFileChange verifies verify candidate detects file change.
|
||||
func TestVerifyCandidateDetectsFileChange(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -47,6 +48,7 @@ func TestVerifyCandidateDetectsFileChange(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestVerifyCandidateMarksMissingDependencyStale verifies verify candidate marks missing dependency stale.
|
||||
func TestVerifyCandidateMarksMissingDependencyStale(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestReposListsTrackedRepositories verifies repos lists tracked repositories.
|
||||
func TestReposListsTrackedRepositories(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -40,6 +41,7 @@ func TestReposListsTrackedRepositories(t *testing.T) {
|
||||
assertContains(t, reposOut, marsRepo+" (1 entries, updated ")
|
||||
}
|
||||
|
||||
// TestReposPrintsNoReposWhenEmpty verifies repos prints no repos when empty.
|
||||
func TestReposPrintsNoReposWhenEmpty(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestSearchReturnsMatchingEntrySnippet verifies search returns matching entry snippet.
|
||||
func TestSearchReturnsMatchingEntrySnippet(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -35,6 +36,7 @@ func TestSearchReturnsMatchingEntrySnippet(t *testing.T) {
|
||||
mustContain(t, searchOut, "gateway")
|
||||
}
|
||||
|
||||
// TestSearchMatchesAliasWithRepoFilter verifies search matches alias with repo filter.
|
||||
func TestSearchMatchesAliasWithRepoFilter(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -83,6 +85,7 @@ func TestSearchMatchesAliasWithRepoFilter(t *testing.T) {
|
||||
mustNotContain(t, searchOut, "[mars-service]")
|
||||
}
|
||||
|
||||
// TestSearchReturnsNoResultsWhenEmpty verifies search returns no results when empty.
|
||||
func TestSearchReturnsNoResultsWhenEmpty(t *testing.T) {
|
||||
fixture := initRepoMemoryTestDB(t)
|
||||
|
||||
@@ -98,6 +101,7 @@ func TestSearchReturnsNoResultsWhenEmpty(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestSearchRejectsMissingQuery verifies search rejects missing query.
|
||||
func TestSearchRejectsMissingQuery(t *testing.T) {
|
||||
fixture := initRepoMemoryTestDB(t)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestVerifyDowngradesChangedFileDependency verifies verify downgrades changed file dependency.
|
||||
func TestVerifyDowngradesChangedFileDependency(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -51,6 +52,7 @@ func TestVerifyDowngradesChangedFileDependency(t *testing.T) {
|
||||
assertContains(t, eventsOut, "downgraded (confirmed -> needs_review)")
|
||||
}
|
||||
|
||||
// TestVerifyMarksMissingHardDependencyStale verifies verify marks missing hard dependency stale.
|
||||
func TestVerifyMarksMissingHardDependencyStale(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -92,6 +94,7 @@ func TestVerifyMarksMissingHardDependencyStale(t *testing.T) {
|
||||
assertContains(t, eventsOut, "marked_stale (confirmed -> stale)")
|
||||
}
|
||||
|
||||
// TestVerifyPrintsNoReposWhenEmpty verifies verify prints no repos when empty.
|
||||
func TestVerifyPrintsNoReposWhenEmpty(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -105,6 +108,7 @@ func TestVerifyPrintsNoReposWhenEmpty(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestVerifySkipsExplicitRepoWithoutGitHead verifies verify skips explicit repo without Git head.
|
||||
func TestVerifySkipsExplicitRepoWithoutGitHead(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
@@ -127,6 +131,7 @@ func TestVerifySkipsExplicitRepoWithoutGitHead(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestVerifyDowngradesEntryMissingVerifiedOnCommit verifies verify downgrades entry missing verified on commit.
|
||||
func TestVerifyDowngradesEntryMissingVerifiedOnCommit(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
runRepoMemoryCommand(t, "init", "--db", fixture.DBPath)
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestWorkflowAddSearchEventsRoundtrip verifies workflow add search events roundtrip.
|
||||
func TestWorkflowAddSearchEventsRoundtrip(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
evidencePath := filepath.Join(fixture.RepoPath, "app", "app", "src", "main", "java", "foo", "AITask.java")
|
||||
@@ -48,6 +49,7 @@ func TestWorkflowAddSearchEventsRoundtrip(t *testing.T) {
|
||||
assertContains(t, eventsOut, "created")
|
||||
}
|
||||
|
||||
// TestWorkflowIngestSearchListAcrossSections verifies workflow ingest search list across sections.
|
||||
func TestWorkflowIngestSearchListAcrossSections(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
docPath := filepath.Join(fixture.RepoPath, "docs", "ai", "repo-memory.md")
|
||||
@@ -92,6 +94,7 @@ func TestWorkflowIngestSearchListAcrossSections(t *testing.T) {
|
||||
assertContains(t, listOut, "danger:repo-memory:danger-zones [confirmed]")
|
||||
}
|
||||
|
||||
// TestWorkflowAddLinkAndResolveRelatedEntry verifies workflow add link and resolve related entry.
|
||||
func TestWorkflowAddLinkAndResolveRelatedEntry(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
evidencePath := filepath.Join(fixture.RepoPath, "docs", "term.md")
|
||||
@@ -148,6 +151,7 @@ func TestWorkflowAddLinkAndResolveRelatedEntry(t *testing.T) {
|
||||
assertContains(t, eventsTwo, "chain:ai-insight.get [confirmed] #2")
|
||||
}
|
||||
|
||||
// TestWorkflowVerifyDowngradesAfterRepoChange verifies workflow verify downgrades after repo change.
|
||||
func TestWorkflowVerifyDowngradesAfterRepoChange(t *testing.T) {
|
||||
fixture := newRepoMemoryFixture(t)
|
||||
evidencePath := filepath.Join(fixture.RepoPath, "foo.txt")
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestParseFile verifies ParseFile loads front matter and markdown sections.
|
||||
func TestParseFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"ai-workflow-skill/packages/repo-memory-runtime/internal/documents"
|
||||
)
|
||||
|
||||
// TestImportDocumentAndSearch verifies imported document sections are searchable.
|
||||
func TestImportDocumentAndSearch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -64,6 +65,7 @@ func TestImportDocumentAndSearch(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestUpsertEntryWithAliasesAndDependencies verifies upsert stores aliases, dependencies, events, and links.
|
||||
func TestUpsertEntryWithAliasesAndDependencies(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -175,6 +177,7 @@ func TestUpsertEntryWithAliasesAndDependencies(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestApplyVerificationResult verifies verification can downgrade an entry and record the downgrade event.
|
||||
func TestApplyVerificationResult(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user