Skip to content

Commit b00451d

Browse files
committed
Fix tests
1 parent 4e70fb6 commit b00451d

6 files changed

Lines changed: 20 additions & 15 deletions

File tree

src/TALXIS.CLI.Workspace/ComponentTypeExplainCliCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public async Task<int> RunAsync()
3131
return 1;
3232
}
3333

34-
Console.WriteLine($"Name: {template.Name}");
35-
Console.WriteLine($"Short names: {string.Join(", ", template.ShortNameList)}");
34+
Console.WriteLine($"Type: {template.ShortNameList.FirstOrDefault()}");
3635
Console.WriteLine($"Description: {template.Description}");
3736
return 0;
3837
}

src/TALXIS.CLI.Workspace/TemplateEngine/TemplateCreationService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ private static void ValidateInputs(string shortName, string outputPath)
7272
if (string.IsNullOrWhiteSpace(shortName))
7373
{
7474
throw new ArgumentException(
75-
"Template short name must be provided.\n\n" +
75+
"Valid component type must be provided.\n\n" +
7676
"💡 Corrective actions:\n" +
77-
" • Provide a valid template short name (e.g., 'webapp', 'console', etc.)\n" +
78-
" • List available templates to see valid short names",
77+
" • Provide a valid template name (e.g., 'pp-entity', 'pp-entity-form', etc.)\n" +
78+
" • List available component types to see valid names",
7979
nameof(shortName));
8080
}
8181

src/TALXIS.CLI.Workspace/TemplateEngine/TemplateDiscoveryService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ private static void ValidateShortName(string shortName)
4040
if (string.IsNullOrWhiteSpace(shortName))
4141
{
4242
throw new ArgumentException(
43-
"Template short name must be provided.\n\n" +
43+
"Component type must be provided.\n\n" +
4444
"💡 Corrective actions:\n" +
45-
" • Provide a valid template short name\n" +
46-
" • List available templates to see valid short names",
45+
" • Provide a valid component type\n" +
46+
" • List available component types to see valid names",
4747
nameof(shortName));
4848
}
4949
}

tests/TALXIS.CLI.IntegrationTests/CliTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public async Task WorkspaceComponentList_ContainsExpectedComponents()
2626
{
2727
var output = await CliRunner.RunAsync("workspace component type list");
2828

29-
Assert.Contains("Available components:", output);
3029
Assert.Contains("pp-entity", output);
31-
Assert.Contains("short name:", output);
3230
}
3331

3432
[Fact]
@@ -37,7 +35,6 @@ public async Task WorkspaceComponentType_ReturnsComponentDetails()
3735
var output = await CliRunner.RunAsync("workspace component type explain pp-entity");
3836

3937
Assert.Contains("Name:", output);
40-
Assert.Contains("Short names:", output);
4138
Assert.Contains("Description:", output);
4239
Assert.Contains("pp-entity", output);
4340
}

tests/TALXIS.CLI.IntegrationTests/EquivalenceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static IEnumerable<object[]> GetTestCases()
4040
{
4141
"workspace component type explain pp-entity",
4242
"workspace_component_type_explain",
43-
new Dictionary<string, object> { { "Name", "pp-entity" } }
43+
new Dictionary<string, object> { { "Type", "pp-entity" } }
4444
};
4545
}
4646

tests/TALXIS.CLI.IntegrationTests/McpTests.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.Linq;
34
using System.Threading.Tasks;
@@ -20,7 +21,7 @@ public async Task ListTools_ReturnsExpectedTools()
2021
var tools = await client.ListToolsAsync();
2122
var toolNames = tools.Select(t => t.Name).ToList();
2223

23-
Assert.Contains("workspace_component_list", toolNames);
24+
Assert.Contains("workspace_component_type_list", toolNames);
2425
Assert.Contains("workspace_component_type_explain", toolNames);
2526
}
2627

@@ -29,7 +30,7 @@ public async Task WorkspaceComponentList_ReturnsValidResponse()
2930
{
3031
var client = await McpClient.InstanceAsync;
3132

32-
var result = await client.CallToolAsync("workspace_component_list");
33+
var result = await client.CallToolAsync("workspace_component_type_list");
3334

3435
Assert.NotNull(result.Content);
3536
Assert.NotEmpty(result.Content);
@@ -40,12 +41,20 @@ public async Task WorkspaceComponentList_ReturnsValidResponse()
4041
public async Task WorkspaceComponentTypeExplain_ReturnsComponentDetails()
4142
{
4243
var client = await McpClient.InstanceAsync;
43-
var args = new Dictionary<string, object> { { "Name", "pp-entity" } };
44+
var args = new Dictionary<string, object> { { "Type", "pp-entity" } };
4445

4546
var result = await client.CallToolAsync("workspace_component_type_explain", args);
4647

4748
Assert.NotNull(result.Content);
4849
Assert.NotEmpty(result.Content);
50+
51+
// Log the actual error for debugging
52+
if (result.IsError == true)
53+
{
54+
var errorContent = result.Content[0] is TextContentBlock errorBlock ? errorBlock.Text : "Unknown error";
55+
throw new InvalidOperationException($"MCP call failed: {errorContent}");
56+
}
57+
4958
Assert.True(result.IsError != true);
5059

5160
if (result.Content[0] is TextContentBlock textBlock)

0 commit comments

Comments
 (0)