test(backend): add embedding text and innovation stage tests
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using TarninaHub.Application.Mappings;
|
||||
using TarninaHub.Application.Text;
|
||||
using TarninaHub.Domain.Enums;
|
||||
|
||||
namespace TarninaHub.Tests.Application;
|
||||
|
||||
public class EmbeddingAndStageTests
|
||||
{
|
||||
[Fact]
|
||||
public void EmbeddingTextBuilder_JoinsNonEmptyParts()
|
||||
{
|
||||
var text = EmbeddingTextBuilder.Build("Tytuł", "Streszczenie", null, "Seniorzy");
|
||||
|
||||
Assert.Equal("Tytuł\nStreszczenie\nSeniorzy", text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EmbeddingTextBuilder_TrimsAndSkipsBlank()
|
||||
{
|
||||
var text = EmbeddingTextBuilder.Build(" Tytuł ", " ", "Opis", null);
|
||||
|
||||
Assert.Equal("Tytuł\nOpis", text);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("idea", true)]
|
||||
[InlineData("pilot", true)]
|
||||
[InlineData("scaling", true)]
|
||||
[InlineData("service", true)]
|
||||
[InlineData("draft", false)]
|
||||
[InlineData("", false)]
|
||||
public void InnovationStageWire_Validates(string value, bool expected)
|
||||
{
|
||||
Assert.Equal(expected, InnovationStageWire.IsValid(value));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(InnovationStage.Idea, "idea")]
|
||||
[InlineData(InnovationStage.Pilot, "pilot")]
|
||||
[InlineData(InnovationStage.Scaling, "scaling")]
|
||||
[InlineData(InnovationStage.Service, "service")]
|
||||
public void InnovationStageWire_RoundTrips(InnovationStage stage, string wire)
|
||||
{
|
||||
Assert.Equal(wire, stage.ToWire());
|
||||
Assert.Equal(stage, InnovationStageWire.Parse(wire));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user