< Summary

Information
Class: Elsa.Platform.Integration.Steps.ConfigureSettingsStep
Assembly: Elsa.Platform.Integration
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Platform.Integration/Steps/ConfigureSettingsStep.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 15
Coverable lines: 15
Total lines: 36
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
get_ShellId()100%210%
get_Settings()100%210%
ValidateAsync(...)0%2040%
ExecuteAsync()0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Platform.Integration/Steps/ConfigureSettingsStep.cs

#LineLine coverage
 1using System.Text.Json;
 2using Elsa.Platform.Integration.Services;
 3using Loom;
 4
 5namespace Elsa.Platform.Integration.Steps;
 6
 7[Step("elsa.configure-settings")]
 08public sealed class ConfigureSettingsStep(
 09    IShellConfigurationOverlayStore overlayStore,
 010    PlatformShellReloadTracker reloadTracker) : IStep, IValidatingStep
 11{
 012    public string ShellId { get; init; } = "Default";
 13
 014    public JsonElement Settings { get; init; }
 15
 16    public ValueTask<IReadOnlyList<RecipeDiagnostic>> ValidateAsync(
 17        StepValidationContext context,
 18        CancellationToken cancellationToken = default)
 19    {
 020        List<RecipeDiagnostic> diagnostics = [];
 021        if (string.IsNullOrWhiteSpace(ShellId))
 022            diagnostics.Add(context.Error("ELSA_PLATFORM_SHELL_ID_REQUIRED", "Shell ID is required.", context.Target("in
 23
 024        if (Settings.ValueKind != JsonValueKind.Object)
 025            diagnostics.Add(context.Error("ELSA_PLATFORM_SETTINGS_REQUIRED", "Settings must be a JSON object.", context.
 26
 027        return ValueTask.FromResult<IReadOnlyList<RecipeDiagnostic>>(diagnostics);
 28    }
 29
 30    public async ValueTask ExecuteAsync(StepContext context, CancellationToken cancellationToken = default)
 31    {
 032        var changed = await overlayStore.ConfigureSettingsAsync(ShellId, Settings, cancellationToken);
 033        if (changed)
 034            reloadTracker.MarkForReload(ShellId);
 035    }
 36}