config component render tests

This commit is contained in:
gaz8860 Gary 2023-05-01 20:09:41 +01:00
parent ab60bccc1d
commit b9e81650b3

View File

@ -0,0 +1,60 @@
using PanoptesFrontend.Data;
using PanoptesFrontend.Pages;
using PanoptesFrontend.Services;
using System.Net;
using System.Net.Http;
public class ModuleConfigTests : TestContext
{
[Fact]
public void ImageNameInputFieldIsPresent()
{
Services.AddSingleton<IHttpService, HttpService>();
// Arrange
using var ctx = new TestContext();
ctx.Services.AddSingleton<IHttpService, HttpService>();
var cut = ctx.RenderComponent<ModConfig>();
// Act
var input = cut.Find("input[name='ImageName']");
// Assert
Assert.NotNull(input);
}
[Fact]
public void EnvironmentVariableFormIsPresent()
{
Services.AddSingleton<IHttpService, HttpService>();
// Arrange
using var ctx = new TestContext();
ctx.Services.AddSingleton<IHttpService, HttpService>();
var cut = ctx.RenderComponent<ModConfig>();
// Act
var envKey= cut.Find("input[name='env_key']");
var envVal = cut.Find("input[name='env_val']");
// Assert
Assert.NotNull(envKey);
Assert.NotNull(envVal);
}
[Fact]
public void VolumeFormIsPresent()
{
Services.AddSingleton<IHttpService, HttpService>();
// Arrange
using var ctx = new TestContext();
ctx.Services.AddSingleton<IHttpService, HttpService>();
var cut = ctx.RenderComponent<ModConfig>();
// Act
var volKey= cut.Find("input[name='vol_key']");
var volVal = cut.Find("input[name='vol_val']");
// Assert
Assert.NotNull(volKey);
Assert.NotNull(volVal);
}
}