test(work-orders): scope the media-allowlist guard to photo categories

Updating this branch onto dev turned MediaRules_StillRejectPdf red, and the
test was the thing that had gone stale, not the rule. SH-171 added documents
to the SH-116 media allowlist for Extra and Aveta in 3454125 — a deliberate
widening with its own review — so asserting that media rejects a PDF outright
now contradicts shipped behaviour.

What this branch actually needs guarded is that the completion-doc allowlist
stopped there. Assert it per category instead: Completion, the category
SH-337 touches, plus Before and After, must all still refuse a PDF.
This commit is contained in:
Alexandre Brandizzi 2026-09-10 14:46:54 -03:00
parent af6faf77e3
commit 6212949fff

View file

@ -1930,10 +1930,19 @@ public class WorkOrderCompletionDocFileRulesTests
}
[Fact]
public void MediaRules_StillRejectPdf()
public void MediaRules_StillRejectPdfOutsideDocumentCategories()
{
// The completion-doc allowlist must not widen the SH-116 media allowlist.
Assert.False(WorkOrderMediaFileRules.IsAllowed(FormFile(Pdf, "completion.pdf", "application/pdf")));
// SH-171 since added documents to media for Extra and Aveta, which is a
// deliberate widening of its own; what this guards is that it stopped
// there. Completion is the category SH-337 touches, and a photo slot
// must still refuse a PDF.
Assert.False(WorkOrderMediaFileRules.IsAllowed(
FormFile(Pdf, "completion.pdf", "application/pdf"), WorkOrderMediaCategory.Completion));
Assert.False(WorkOrderMediaFileRules.IsAllowed(
FormFile(Pdf, "completion.pdf", "application/pdf"), WorkOrderMediaCategory.Before));
Assert.False(WorkOrderMediaFileRules.IsAllowed(
FormFile(Pdf, "completion.pdf", "application/pdf"), WorkOrderMediaCategory.After));
}
}