mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-01 15:43:14 +00:00
test(work-orders): expect media content route
This commit is contained in:
parent
9d8ae5ec24
commit
143d613547
1 changed files with 21 additions and 2 deletions
|
|
@ -38,8 +38,8 @@ public class WorkOrderRouteContractTests
|
|||
/// Baseline public endpoint set (verb + action-relative route) that the original single
|
||||
/// WorkOrderController exposed, plus the author-only board-comment edit endpoint (SH-122).
|
||||
/// Every action is reachable under both api/WorkOrder and api/workorders; that base-route
|
||||
/// duplication is collapsed here, so this is the distinct action-relative contract. 51 routes
|
||||
/// come from 49 actions (Editworkorder and GetWorkorderById each bind two routes).
|
||||
/// duplication is collapsed here, so this is the distinct action-relative contract. 52 routes
|
||||
/// come from 50 actions (Editworkorder and GetWorkorderById each bind two routes).
|
||||
/// </summary>
|
||||
private static readonly HashSet<string> ExpectedWorkOrderEndpoints = new(StringComparer.Ordinal)
|
||||
{
|
||||
|
|
@ -67,6 +67,7 @@ public class WorkOrderRouteContractTests
|
|||
"GET {id:int}/detail",
|
||||
"GET {id:int}/uplifts",
|
||||
"GET {id:int}/media",
|
||||
"GET {id:int}/media/{mediaId:int}/content",
|
||||
"PATCH {id:int}/board",
|
||||
"PATCH {id:int}/comments/{commentId:int}",
|
||||
"PATCH {id:int}/media/{mediaId:int}",
|
||||
|
|
@ -168,6 +169,24 @@ public class WorkOrderRouteContractTests
|
|||
unexpected.Should().BeEmpty("the split must not introduce new public WorkOrder endpoints");
|
||||
actual.Should().HaveCount(ExpectedWorkOrderEndpoints.Count,
|
||||
"the distinct action-relative endpoint count must match the baseline");
|
||||
actual.Should().NotContain(endpoint =>
|
||||
endpoint.Contains("documents", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WorkOrder_Family_Does_Not_Expose_Documents_Route()
|
||||
{
|
||||
ExpectedWorkOrderEndpoints.Should().Contain("GET {id:int}/media/{mediaId:int}/content");
|
||||
ExpectedWorkOrderEndpoints.Should().NotContain(endpoint =>
|
||||
endpoint.Contains("documents", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var actual = FullRoutesFor(a => a is ControllerActionDescriptor cad
|
||||
&& WorkOrderFamilyControllerTypes.Contains(cad.ControllerTypeInfo))
|
||||
.Select(t => $"{t.Verb} {Normalize(t.FullTemplate)}")
|
||||
.ToHashSet(StringComparer.Ordinal);
|
||||
|
||||
actual.Should().NotContain(endpoint =>
|
||||
endpoint.Contains("documents", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue