| 1 | using AgentForge.Abstractions; |
| 2 | using AgentForge.Plugin.View; |
| 3 | |
| 4 | namespace AgentForge.Tests; |
| 5 | |
| 6 | public sealed class ForgeGitViewHelpersTests |
| 7 | { |
| 8 | [Theory] |
| 9 | [InlineData(null, "code")] |
| 10 | [InlineData("", "code")] |
| 11 | [InlineData("code", "code")] |
| 12 | [InlineData("issue", "issues")] |
| 13 | [InlineData("mr", "merge-requests")] |
| 14 | [InlineData("ci", "ci")] |
| 15 | [InlineData("CI", "ci")] |
| 16 | [InlineData("unknown", "code")] |
| 17 | public void NormalizeRepoTab_resolves_aliases_and_plugin_tabs(string? tab, string expected) |
| 18 | { |
| 19 | var catalog = new StubViewCatalog(["issues", "merge-requests", "ci"]); |
| 20 | |
| 21 | var actual = ForgeGitViewHelpers.NormalizeRepoTab(tab, catalog); |
| 22 | |
| 23 | Assert.Equal(expected, actual); |
| 24 | } |
| 25 | |
| 26 | private sealed class StubViewCatalog(HashSet<string> tabs) : IForgeViewContributorCatalog |
| 27 | { |
| 28 | public IReadOnlyList<ForgeViewContributor> Contributors => []; |
| 29 | |
| 30 | public bool HasTab(string tabId) => tabs.Contains(tabId); |
| 31 | } |
| 32 | } |
| 33 | |
View only · write via MCP/CIDE