Add integration test for newGuid() in JavaScript evaluator.
Introduces a new unit test in `Elsa.JavaScript.IntegrationTests` to verify that the `newGuid()` function in the JavaScript evaluator correctly returns a `Guid` type.
This commit is contained in:
parent
30c1f16c15
commit
d84e97945c
|
|
@ -0,0 +1,33 @@
|
|||
using Elsa.Expressions.Models;
|
||||
using Elsa.JavaScript.Contracts;
|
||||
using Elsa.Testing.Shared;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Elsa.JavaScript.IntegrationTests;
|
||||
|
||||
public class GuidTests
|
||||
{
|
||||
private readonly IJavaScriptEvaluator _evaluator;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
public GuidTests(ITestOutputHelper testOutputHelper)
|
||||
{
|
||||
_serviceProvider = new TestApplicationBuilder(testOutputHelper).Build();
|
||||
_evaluator = _serviceProvider.GetRequiredService<IJavaScriptEvaluator>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task NewGuidReturnsGuid()
|
||||
{
|
||||
//Setup
|
||||
var script = "newGuid()";
|
||||
var expressionExecutionContext = new ExpressionExecutionContext(_serviceProvider, new());
|
||||
|
||||
//Act
|
||||
var result = (Guid)(await _evaluator.EvaluateAsync(script, typeof(Guid), expressionExecutionContext))!;
|
||||
|
||||
//Assert
|
||||
Assert.IsType<Guid>(result);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue