test: adds unit, integration and security test projects for the web project

This commit is contained in:
BinaryAlley committed 2026-08-17 11:52:28 -07:00
1 parent 7b56033a15
commit 7ad7ad308e
70 files changed
+4993

No files matched your search

@@ -0,0 +1,49 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Services;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.UnitTests.Common.Services;
/// <summary>
/// Contains unit tests for the <see cref="ScriptIdentifierHelper"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class ScriptIdentifierHelperTests
{
[Fact]
public void GenerateScriptId_WhenCalled_ShouldReturnScriptPrefixedIdentifier()
{
// Act
string scriptId = ScriptIdentifierHelper.GenerateScriptId();
// Assert
Assert.StartsWith("script_", scriptId);
Assert.True(Guid.TryParse(scriptId.AsSpan("script_".Length), out _));
}
[Fact]
public void GenerateScriptId_WhenCalledTwice_ShouldReturnDistinctIdentifiers()
{
// Act
string firstScriptId = ScriptIdentifierHelper.GenerateScriptId();
string secondScriptId = ScriptIdentifierHelper.GenerateScriptId();
// Assert
Assert.NotEqual(firstScriptId, secondScriptId);
}
[Fact]
public void ClearIdentifier_WhenCalledWithGeneratedIdentifier_ShouldNotThrow()
{
// Arrange
string scriptId = ScriptIdentifierHelper.GenerateScriptId();
// Act
ScriptIdentifierHelper.ClearIdentifier(scriptId);
// Assert
Assert.NotNull(scriptId);
}
}