test(backend): add xUnit tests for the API skeleton
Add tests/TarninaHub.Tests with health controller and SurrealDB endpoint builder tests, and register the test and layer projects in the solution.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using TarninaHub.Infrastructure.Settings;
|
||||
|
||||
namespace TarninaHub.Tests.Infrastructure;
|
||||
|
||||
public class SurrealDbEndpointTests
|
||||
{
|
||||
[Fact]
|
||||
public void Build_ReturnsRemoteUrl_WhenConfigured()
|
||||
{
|
||||
var settings = new SurrealDbSettings
|
||||
{
|
||||
RemoteUrl = "ws://127.0.0.1:8010/rpc",
|
||||
};
|
||||
|
||||
var endpoint = SurrealDbEndpoint.Build(settings);
|
||||
|
||||
Assert.Equal("ws://127.0.0.1:8010/rpc", endpoint);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Build_ReturnsRocksDbEndpoint_WithForwardSlashes_WhenEmbedded()
|
||||
{
|
||||
var settings = new SurrealDbSettings
|
||||
{
|
||||
DataDirectory = "data",
|
||||
};
|
||||
|
||||
var endpoint = SurrealDbEndpoint.Build(settings);
|
||||
|
||||
Assert.StartsWith("rocksdb://", endpoint);
|
||||
Assert.DoesNotContain('\\', endpoint);
|
||||
Assert.EndsWith("/data", endpoint);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user