поправлены дубли шагов
Tests / frontend-test (push) Successful in 46s
Tests / backend-test (push) Successful in 1m59s

This commit is contained in:
gorbenko.pavel
2026-08-11 10:07:41 +05:00
parent 0dedabc2ae
commit 509f26de7b
2 changed files with 101 additions and 18 deletions
@@ -150,6 +150,70 @@ public sealed class TemplateRouteStepServiceTests : IClassFixture<PostgresDataba
directorTansu.IsSuccess.ShouldBeTrue();
}
[Fact(DisplayName = "Два шага с одним типом руководителя, но разными условиями появления — допустимы")]
public async Task CreateAsync_SameHeadTypeDifferentConditions_BothSucceed()
{
// Arrange — условия появления взаимоисключающи по данным заявки, поэтому
// в конкретный резолв попадёт только один из двух шагов.
var routeId = await CreateRouteAsync("Route with head type per condition", byProject: false, listName: "Requests");
// Action
var small = await _service.CreateAsync(
routeId,
new CreateTemplateRouteStepRequest(1, null, null, null, HeadType.Chief, RouteStepStatus.Approval, false, "Amount", ComparisonOperator.LessThan, "1000"),
CancellationToken.None);
var big = await _service.CreateAsync(
routeId,
new CreateTemplateRouteStepRequest(2, null, null, null, HeadType.Chief, RouteStepStatus.Approval, false, "Amount", ComparisonOperator.GreaterThan, "1000"),
CancellationToken.None);
// Assert
small.IsSuccess.ShouldBeTrue();
big.IsSuccess.ShouldBeTrue();
}
[Fact(DisplayName = "Два шага с одним конкретным исполнителем, но разными условиями появления — допустимы")]
public async Task CreateAsync_SameExecutorDifferentConditions_BothSucceed()
{
// Arrange
var routeId = await CreateRouteAsync("Route with executor per condition", byProject: false, listName: "Requests");
// Action
var small = await _service.CreateAsync(
routeId,
new CreateTemplateRouteStepRequest(1, "a@b.kz", null, null, null, RouteStepStatus.Approval, false, "Amount", ComparisonOperator.LessThan, "1000"),
CancellationToken.None);
var big = await _service.CreateAsync(
routeId,
new CreateTemplateRouteStepRequest(2, "a@b.kz", null, null, null, RouteStepStatus.Approval, false, "Amount", ComparisonOperator.GreaterThan, "1000"),
CancellationToken.None);
// Assert
small.IsSuccess.ShouldBeTrue();
big.IsSuccess.ShouldBeTrue();
}
[Fact(DisplayName = "Два шага с одним типом руководителя и одинаковым условием появления — конфликт")]
public async Task CreateAsync_SameHeadTypeSameCondition_ReturnsFailedResult()
{
// Arrange
var routeId = await CreateRouteAsync("Route with head type same condition", byProject: false, listName: "Requests");
var first = await _service.CreateAsync(
routeId,
new CreateTemplateRouteStepRequest(1, null, null, null, HeadType.Chief, RouteStepStatus.Approval, false, "Amount", ComparisonOperator.GreaterThan, "1000"),
CancellationToken.None);
first.IsSuccess.ShouldBeTrue();
// Action — то же условие, другой статус
var second = await _service.CreateAsync(
routeId,
new CreateTemplateRouteStepRequest(2, null, null, null, HeadType.Chief, RouteStepStatus.Execution, false, "Amount", ComparisonOperator.GreaterThan, "1000"),
CancellationToken.None);
// Assert
second.IsFailed.ShouldBeTrue();
}
[Fact(DisplayName = "Обновление шага, при котором HeadType не меняется, не конфликтует само с собой")]
public async Task UpdateAsync_SameHeadTypeOnSameStep_DoesNotConflictWithItself()
{