csharpdeeb25a2 | 1 | using CascadeIDE.Services; |
| 2 | using Xunit; |
| 3 | |
| 4 | namespace CascadeIDE.Tests; |
| 5 | |
| 6 | public sealed class KbBaseKnowledgeListMergerTests |
| 7 | { |
| 8 | [Fact] |
| 9 | public void Merge_OverlayWinsDuplicatePath() |
| 10 | { |
| 11 | const string overlay = |
| 12 | """ |
| 13 | { |
| 14 | "path": "/o", |
| 15 | "files": [ |
| 16 | { "path": "a.md", "size_bytes": 1, "modified_utc": "2020-01-01T00:00:00Z" } |
| 17 | ], |
| 18 | "total": 1 |
| 19 | } |
| 20 | """; |
| 21 | const string embedded = |
| 22 | """ |
| 23 | { |
| 24 | "path": "/e", |
| 25 | "files": [ |
| 26 | { "path": "a.md", "size_bytes": 999, "modified_utc": "1999-01-01T00:00:00Z" }, |
| 27 | { "path": "b.md", "size_bytes": 2, "modified_utc": "2020-01-02T00:00:00Z" } |
| 28 | ], |
| 29 | "total": 2 |
| 30 | } |
| 31 | """; |
| 32 | |
| 33 | var merged = KbBaseKnowledgeListMerger.Merge(overlay, embedded, "hint"); |
| 34 | |
| 35 | Assert.Contains("\"path\": \"hint\"", merged, StringComparison.Ordinal); |
| 36 | Assert.Contains("\"a.md\"", merged, StringComparison.Ordinal); |
| 37 | Assert.Contains("\"size_bytes\": 1", merged, StringComparison.Ordinal); |
| 38 | Assert.Contains("\"b.md\"", merged, StringComparison.Ordinal); |
| 39 | Assert.DoesNotContain("999", merged, StringComparison.Ordinal); |
| 40 | } |
| 41 | } |
| 42 | |
View only · write via MCP/CIDE