| 1 | using CascadeIDE.Features.Chat; |
| 2 | using Xunit; |
| 3 | |
| 4 | namespace CascadeIDE.Tests; |
| 5 | |
| 6 | public sealed class ChatSlashCommandParserTests |
| 7 | { |
| 8 | [Fact] |
| 9 | public void IsSlashLine_NotSlash_ReturnsFalse() |
| 10 | { |
| 11 | Assert.False(ChatSlashCommandParser.IsSlashLine("hello")); |
| 12 | } |
| 13 | |
| 14 | [Fact] |
| 15 | public void TryResolveInput_IntercomOverview() |
| 16 | { |
| 17 | ChatSlashCatalogTestSupport.AssertResolves("/intercom overview", "/intercom overview"); |
| 18 | } |
| 19 | |
| 20 | [Fact] |
| 21 | public void TryResolveInput_BuildRun() |
| 22 | { |
| 23 | ChatSlashCatalogTestSupport.AssertResolves("/build run", "/build run"); |
| 24 | } |
| 25 | |
| 26 | [Fact] |
| 27 | public void TryResolveInput_IntercomTopicCreate() |
| 28 | { |
| 29 | ChatSlashCatalogTestSupport.AssertResolves( |
| 30 | "/intercom topic create", |
| 31 | "/intercom topic create"); |
| 32 | } |
| 33 | |
| 34 | [Fact] |
| 35 | public void TryResolveInput_IntercomTopicCreate_WithTitle() |
| 36 | { |
| 37 | ChatSlashCatalogTestSupport.AssertResolves( |
| 38 | "/intercom topic create ADR 0119", |
| 39 | "/intercom topic create", |
| 40 | "ADR 0119"); |
| 41 | } |
| 42 | |
| 43 | [Theory] |
| 44 | [InlineData("/intercom server status", "/intercom server status")] |
| 45 | [InlineData("/build run", "/build run")] |
| 46 | [InlineData("/help", "/help")] |
| 47 | public void TryResolveInput_CatalogPaths(string line, string expectedPath) |
| 48 | { |
| 49 | ChatSlashCatalogTestSupport.AssertResolves(line, expectedPath); |
| 50 | } |
| 51 | |
| 52 | [Theory] |
| 53 | [InlineData("/intercom topic open bbbbbbbb", true)] |
| 54 | [InlineData("/intercom topic open Ветка", true)] |
| 55 | [InlineData("/intercom spine open", true)] |
| 56 | [InlineData("/intercom topic cards", true)] |
| 57 | [InlineData("/intercom topic open", true)] |
| 58 | public void ShouldAutoExecuteAfterAutocompleteCommit(string line, bool expected) |
| 59 | { |
| 60 | Assert.Equal(expected, ChatSlashCommandParser.ShouldAutoExecuteAfterAutocompleteCommit(line)); |
| 61 | } |
| 62 | } |
| 63 | |