mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-05 22:22:13 +00:00
test(uplifts): cover Admin request-changes and evidence download with empty tier config (SH-327)
This commit is contained in:
parent
cfb05a906f
commit
26b4aaf1b2
1 changed files with 41 additions and 0 deletions
|
|
@ -123,6 +123,47 @@ public sealed class UpliftAdminApprovalTests
|
||||||
context.Dispatches.Single().NTEAmount.Should().Be(1000m);
|
context.Dispatches.Single().NTEAmount.Should().Be(1000m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task RequestChanges_Admin_WithEmptyTierConfig_Succeeds()
|
||||||
|
{
|
||||||
|
using var context = NewContext();
|
||||||
|
await SeedPendingAsync(context, 2);
|
||||||
|
var service = NewService(context);
|
||||||
|
|
||||||
|
var result = await service.RequestChangesAsync(UserWithRoles("Admin"), 1, "more detail", CancellationToken.None);
|
||||||
|
|
||||||
|
result.Status.Should().Be(UpliftStatus.ChangesRequested);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EvidenceDownload_Admin_WithEmptyTierConfig_ReturnsFile()
|
||||||
|
{
|
||||||
|
using var context = NewContext();
|
||||||
|
var dispatch = await SeedPendingAsync(context, 2);
|
||||||
|
context.VendorCompletionDocuments.Add(new VendorCompletionDocument
|
||||||
|
{
|
||||||
|
VendorId = dispatch.VendorId,
|
||||||
|
DispatchId = dispatch.Id,
|
||||||
|
WorkOrderId = dispatch.WorkOrderId!.Value,
|
||||||
|
OriginalFileName = "invoice.pdf",
|
||||||
|
StoredFileName = "evidence.bin",
|
||||||
|
ContentType = "application/pdf",
|
||||||
|
SizeBytes = 4,
|
||||||
|
ScanStatus = "Passed",
|
||||||
|
ReviewStatus = "Approved",
|
||||||
|
Purpose = "UpliftEvidence",
|
||||||
|
Version = 1
|
||||||
|
});
|
||||||
|
context.DispatchUpliftRequests.Single().EvidenceDocumentId = 1;
|
||||||
|
await context.SaveChangesAsync();
|
||||||
|
var service = NewService(context);
|
||||||
|
|
||||||
|
var result = await service.GetEvidenceForDownloadAsync(UserWithRoles("Admin"), 1, CancellationToken.None);
|
||||||
|
|
||||||
|
result.Outcome.Should().Be(VendorDocumentDownloadOutcome.Ok);
|
||||||
|
result.FileName.Should().Be("invoice.pdf");
|
||||||
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("Dispatcher")]
|
[InlineData("Dispatcher")]
|
||||||
[InlineData("Scheduler")]
|
[InlineData("Scheduler")]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue