< Summary

Information
Class: Elsa.Expressions.JavaScript.ObjectConverters.EnumToStringConverter
Assembly: Elsa.Expressions.JavaScript
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.JavaScript/ObjectConverters/EnumToStringConverter.cs
Line coverage
60%
Covered lines: 3
Uncovered lines: 2
Coverable lines: 5
Total lines: 21
Line coverage: 60%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
TryConvert(...)50%2260%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.JavaScript/ObjectConverters/EnumToStringConverter.cs

#LineLine coverage
 1using System.Diagnostics.CodeAnalysis;
 2using Jint;
 3using Jint.Native;
 4using Jint.Runtime.Interop;
 5
 6namespace Elsa.Expressions.JavaScript.ObjectConverters;
 7
 8internal class EnumToStringConverter : IObjectConverter
 9{
 10    public bool TryConvert(Engine engine, object value, [NotNullWhen(true)] out JsValue? result)
 11    {
 656912        if (value is Enum)
 13        {
 014            result = value.ToString();
 015            return true;
 16        }
 17
 656918        result = JsValue.Null;
 656919        return false;
 20    }
 21}