[CLAUDE] Tests: Plan AB Chunk A2 — fix Plan M tests filter LogTransition entry post Plan AB
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m16s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m16s
Plan AB Chunk A thêm Changelog entry mới (EntityType=Workflow + Summary
"Trả lại (...)" + ContextNote=null) trong ApplyReturnModeAsync end-of-function.
Plan M edge case tests (OneLevel_AtStep1Level1 + OneStep_AtStep1) assert
ContextNote.Contains("không lùi được") qua OrderByDescending(CreatedAt) — SQLite
frozen test clock cùng CreatedAt 2 entry → tie-break non-deterministic → pick
Plan AB entry (ContextNote=null) → FAIL.
Fix: Test query filter by Summary.Contains("Chuyển phase") để pick đúng
LogTransitionAsync entry (chứa "không lùi được" trong ContextNote).
Verify:
- dotnet test SolutionErp.slnx — 111/111 PASS (58 Domain + 53 Infra)
- KHÔNG đụng code Plan AB Chunk A — code stays clean, tests get more specific
- Pattern saved: multi-Changelog.Add() per transaction → tests filter by EntityType/Summary discriminator
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -301,8 +301,11 @@ public class PurchaseEvaluationWorkflowServiceReturnModeTests
|
|||||||
// Audit log "không lùi được" phải xuất hiện ở ContextNote (LogTransitionAsync
|
// Audit log "không lùi được" phải xuất hiện ở ContextNote (LogTransitionAsync
|
||||||
// append summary từ ApplyReturnModeAsync vào field này — line 96-99 service).
|
// append summary từ ApplyReturnModeAsync vào field này — line 96-99 service).
|
||||||
// Summary field cố định "Chuyển phase {from} → {to}".
|
// Summary field cố định "Chuyển phase {from} → {to}".
|
||||||
|
// Plan AB S25 thêm Changelog entry mới (EntityType=Workflow + Summary="Trả lại (...)"
|
||||||
|
// + ContextNote=null) → cùng CreatedAt SQLite tie-break non-deterministic. Filter
|
||||||
|
// by Summary "Chuyển phase" để pick đúng LogTransitionAsync entry.
|
||||||
var changelog = await db.PurchaseEvaluationChangelogs
|
var changelog = await db.PurchaseEvaluationChangelogs
|
||||||
.Where(c => c.PurchaseEvaluationId == pe.Id)
|
.Where(c => c.PurchaseEvaluationId == pe.Id && c.Summary!.Contains("Chuyển phase"))
|
||||||
.OrderByDescending(c => c.CreatedAt)
|
.OrderByDescending(c => c.CreatedAt)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
changelog.ContextNote.Should().NotBeNull();
|
changelog.ContextNote.Should().NotBeNull();
|
||||||
@ -343,8 +346,10 @@ public class PurchaseEvaluationWorkflowServiceReturnModeTests
|
|||||||
pe.CurrentApprovalLevelOrder.Should().Be(1, "Pointer reset Cấp 1 (bàn giao về Approver A)");
|
pe.CurrentApprovalLevelOrder.Should().Be(1, "Pointer reset Cấp 1 (bàn giao về Approver A)");
|
||||||
pe.SlaDeadline.Should().NotBeNull("SLA reset 7d cho approver mới");
|
pe.SlaDeadline.Should().NotBeNull("SLA reset 7d cho approver mới");
|
||||||
|
|
||||||
|
// Plan AB S25 — thêm Changelog Workflow entry, filter LogTransition entry
|
||||||
|
// qua Summary "Chuyển phase" để pick đúng row có ContextNote.
|
||||||
var changelog = await db.PurchaseEvaluationChangelogs
|
var changelog = await db.PurchaseEvaluationChangelogs
|
||||||
.Where(c => c.PurchaseEvaluationId == pe.Id)
|
.Where(c => c.PurchaseEvaluationId == pe.Id && c.Summary!.Contains("Chuyển phase"))
|
||||||
.OrderByDescending(c => c.CreatedAt)
|
.OrderByDescending(c => c.CreatedAt)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
changelog.ContextNote.Should().NotBeNull();
|
changelog.ContextNote.Should().NotBeNull();
|
||||||
|
|||||||
Reference in New Issue
Block a user