| 1 | using Xunit; |
| 2 | |
| 3 | namespace CascadeIDE.Tests; |
| 4 | |
| 5 | /// <summary> |
| 6 | /// Контракт discoverability: навигация на фиксированные страницы вторичного контура |
| 7 | /// должна быть и в палитре, и в Command Melody (<c>c:</c>). Новую такую команду — |
| 8 | /// сюда + <see cref="IdeCommandRegistry"/> + <c>intent-catalog.toml</c>. |
| 9 | /// </summary> |
| 10 | public sealed class IdeCommandPaletteMelodyContractTests |
| 11 | { |
| 12 | private static readonly string[] MfdPageNavigationCommandIds = |
| 13 | [ |
| 14 | IdeCommands.ShowEnvironmentReadinessPage, |
| 15 | IdeCommands.ShowHybridIndexPage, |
| 16 | IdeCommands.ShowWebAiPortalPage, |
| 17 | ]; |
| 18 | |
| 19 | [Fact] |
| 20 | public void Mfd_page_navigation_commands_have_palette_catalog_entries() |
| 21 | { |
| 22 | var catalogIds = IdeCommandPaletteCatalog.All.Select(e => e.CommandId).ToHashSet(StringComparer.Ordinal); |
| 23 | foreach (var id in MfdPageNavigationCommandIds) |
| 24 | Assert.Contains(id, catalogIds); |
| 25 | } |
| 26 | |
| 27 | [Fact] |
| 28 | public void Mfd_page_navigation_commands_have_at_least_one_intent_melody_alias() |
| 29 | { |
| 30 | var counts = IntentMelodyAliases.AllPairs() |
| 31 | .GroupBy(p => p.CommandId, StringComparer.Ordinal) |
| 32 | .ToDictionary(g => g.Key, g => g.Count(), StringComparer.Ordinal); |
| 33 | |
| 34 | foreach (var id in MfdPageNavigationCommandIds) |
| 35 | { |
| 36 | Assert.True( |
| 37 | counts.TryGetValue(id, out var n) && n >= 1, |
| 38 | $"Ожидался хотя бы один alias в IntentMelody для «{id}» (файл intent-catalog.toml)."); |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |