Refactor code structure for improved readability and maintainability; removed redundant code blocks and optimized function calls.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using StellaOps.Scanner.Analyzers.Lang.Node.Internal;
|
||||
|
||||
namespace StellaOps.Scanner.Analyzers.Lang.Node.Tests.Node;
|
||||
|
||||
public sealed class NodeEntrypointTests
|
||||
{
|
||||
[Fact]
|
||||
public void Create_NormalizesConditions_DedupesAndSorts()
|
||||
{
|
||||
var entry = NodeEntrypoint.Create(
|
||||
path: "src/index.js",
|
||||
binName: "cli",
|
||||
mainField: "index.js",
|
||||
moduleField: null,
|
||||
conditions: new[] { "node", "browser", "node" });
|
||||
|
||||
Assert.Equal("browser,node", entry.ConditionSet);
|
||||
Assert.Equal("src/index.js", entry.Path);
|
||||
Assert.Equal("cli", entry.BinName);
|
||||
Assert.Equal("index.js", entry.MainField);
|
||||
Assert.Null(entry.ModuleField);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create_AllowsEmptyConditions()
|
||||
{
|
||||
var entry = NodeEntrypoint.Create("src/app.js", null, null, null, Array.Empty<string>());
|
||||
Assert.Equal(string.Empty, entry.ConditionSet);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user