refactor(git): share the info/exclude writer with the findings store
This commit is contained in:
@@ -25,7 +25,7 @@ public sealed class FindingsStoreTests : IDisposable
|
||||
{
|
||||
var store = new FindingsStore();
|
||||
|
||||
var outcome = await store.SaveAsync(_root, Input("conpty-arg-quoting"), CancellationToken.None);
|
||||
var outcome = await store.SaveAsync(_root, Input("conpty-arg-quoting"), CancellationToken.None, tracked: true);
|
||||
|
||||
Assert.True(outcome.Created);
|
||||
Assert.Equal("conpty-arg-quoting", outcome.Slug);
|
||||
@@ -44,9 +44,9 @@ public sealed class FindingsStoreTests : IDisposable
|
||||
public async Task SaveAsync_SameSlugOverwritesInsteadOfCreatingASecondFile()
|
||||
{
|
||||
var store = new FindingsStore();
|
||||
await store.SaveAsync(_root, Input("dup", "First title"), CancellationToken.None);
|
||||
await store.SaveAsync(_root, Input("dup", "First title"), CancellationToken.None, tracked: true);
|
||||
|
||||
var outcome = await store.SaveAsync(_root, Input("dup", "Second title"), CancellationToken.None);
|
||||
var outcome = await store.SaveAsync(_root, Input("dup", "Second title"), CancellationToken.None, tracked: true);
|
||||
|
||||
Assert.False(outcome.Created);
|
||||
Assert.Equal(1, outcome.TotalFindings);
|
||||
@@ -61,8 +61,8 @@ public sealed class FindingsStoreTests : IDisposable
|
||||
public async Task SaveAsync_RebuildsIndexFromDiskSortedBySlug()
|
||||
{
|
||||
var store = new FindingsStore();
|
||||
await store.SaveAsync(_root, Input("zulu", "Zulu trap"), CancellationToken.None);
|
||||
await store.SaveAsync(_root, Input("alpha", "Alpha trap"), CancellationToken.None);
|
||||
await store.SaveAsync(_root, Input("zulu", "Zulu trap"), CancellationToken.None, tracked: true);
|
||||
await store.SaveAsync(_root, Input("alpha", "Alpha trap"), CancellationToken.None, tracked: true);
|
||||
|
||||
var index = await File.ReadAllTextAsync(Path.Combine(_root, ".claudedo", "INDEX.md"));
|
||||
var lines = index.Replace("\r\n", "\n").Split('\n');
|
||||
@@ -78,11 +78,11 @@ public sealed class FindingsStoreTests : IDisposable
|
||||
public async Task SaveAsync_IndexDropsFindingsDeletedOnDisk()
|
||||
{
|
||||
var store = new FindingsStore();
|
||||
await store.SaveAsync(_root, Input("gone", "Gone trap"), CancellationToken.None);
|
||||
await store.SaveAsync(_root, Input("stays", "Stays trap"), CancellationToken.None);
|
||||
await store.SaveAsync(_root, Input("gone", "Gone trap"), CancellationToken.None, tracked: true);
|
||||
await store.SaveAsync(_root, Input("stays", "Stays trap"), CancellationToken.None, tracked: true);
|
||||
|
||||
File.Delete(Path.Combine(_root, ".claudedo", "traps", "gone.md"));
|
||||
await store.SaveAsync(_root, Input("stays", "Stays trap"), CancellationToken.None);
|
||||
await store.SaveAsync(_root, Input("stays", "Stays trap"), CancellationToken.None, tracked: true);
|
||||
|
||||
var index = await File.ReadAllTextAsync(Path.Combine(_root, ".claudedo", "INDEX.md"));
|
||||
Assert.DoesNotContain("gone", index);
|
||||
@@ -100,7 +100,7 @@ public sealed class FindingsStoreTests : IDisposable
|
||||
var store = new FindingsStore();
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentException>(
|
||||
() => store.SaveAsync(_root, Input(slug), CancellationToken.None));
|
||||
() => store.SaveAsync(_root, Input(slug), CancellationToken.None, tracked: true));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -109,7 +109,7 @@ public sealed class FindingsStoreTests : IDisposable
|
||||
var store = new FindingsStore();
|
||||
SaveFindingOutcome outcome = null!;
|
||||
for (var i = 0; i < FindingsStore.WarnThreshold; i++)
|
||||
outcome = await store.SaveAsync(_root, Input($"trap-{i:000}"), CancellationToken.None);
|
||||
outcome = await store.SaveAsync(_root, Input($"trap-{i:000}"), CancellationToken.None, tracked: true);
|
||||
|
||||
Assert.Equal(FindingsStore.WarnThreshold, outcome.TotalFindings);
|
||||
Assert.True(outcome.NearCapacity);
|
||||
@@ -120,7 +120,7 @@ public sealed class FindingsStoreTests : IDisposable
|
||||
{
|
||||
var store = new FindingsStore();
|
||||
|
||||
var outcome = await store.SaveAsync(_root, Input("only-one"), CancellationToken.None);
|
||||
var outcome = await store.SaveAsync(_root, Input("only-one"), CancellationToken.None, tracked: true);
|
||||
|
||||
Assert.False(outcome.NearCapacity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user