41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
using System.Text.Json;
|
|
using Sdt.Config;
|
|
using Xunit;
|
|
|
|
namespace DevTool.Tests;
|
|
|
|
public sealed class DebugConfigTests
|
|
{
|
|
[Fact]
|
|
public void DebugSectionAbsent_DeserializesWithSafeDefaults()
|
|
{
|
|
const string json = """
|
|
{
|
|
"name": "Test",
|
|
"version": "1.0.0",
|
|
"workflows": []
|
|
}
|
|
""";
|
|
|
|
var cfg = JsonSerializer.Deserialize<DevToolConfig>(json, new JsonSerializerOptions
|
|
{
|
|
PropertyNameCaseInsensitive = true,
|
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
|
AllowTrailingCommas = true,
|
|
ReadCommentHandling = JsonCommentHandling.Skip
|
|
});
|
|
|
|
Assert.NotNull(cfg);
|
|
Assert.Null(cfg!.Debug);
|
|
}
|
|
|
|
[Fact]
|
|
public void DebugDiagnostics_DefaultOutputDir_IsSdtDebug()
|
|
{
|
|
var options = new DebugDiagnosticsOptions();
|
|
Assert.True(options.Enabled);
|
|
Assert.True(options.BundleOnFailure);
|
|
Assert.Equal(".sdt/debug", options.OutputDir);
|
|
}
|
|
}
|