test(event-subscriber): approval arrives as partial_update, not update (refs #153)
The e2e reached INGEDIEND but never INGESCHREVEN. NRC's own log says why:
{"event": "notification_received", "action": "partial_update",
"resource_url": "http://objecten.local:8000/api/v2/objects/a9a7f125-..."}
The ACL PATCHes the object on approval. DRF routes a PATCH through the notifying `update()`
but reports the action as `partial_update`, so accepting only `create`/`update` drops every
approval on the floor — the exact state change the slice exists to project.
Red: the approval case is now a Theory over both acties, and the partial_update one fails.
This commit is contained in:
@@ -38,13 +38,17 @@ public sealed class NotificationProjectorTests
|
||||
Assert.Equal("REG-2026-0001", entry.Reference);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task approval_updates_the_same_row_from_ingediend_to_ingeschreven()
|
||||
// The ACL PATCHes the same object on approval. DRF routes a PATCH through `update()` but reports
|
||||
// the action as `partial_update`, which is what Objecten puts in the notification — so accepting
|
||||
// only `create`/`update` silently drops every approval.
|
||||
[Theory]
|
||||
[InlineData("partial_update")]
|
||||
[InlineData("update")]
|
||||
public async Task approval_updates_the_same_row_from_ingediend_to_ingeschreven(string actie)
|
||||
{
|
||||
var projector = Projector();
|
||||
await projector.HandleAsync(RecordWritten());
|
||||
// The ACL PATCHes the same object on approval, so Objecten publishes an `update`.
|
||||
await projector.HandleAsync(RecordWritten("update", status: RegistrationStatus.Ingeschreven));
|
||||
await projector.HandleAsync(RecordWritten(actie, status: RegistrationStatus.Ingeschreven));
|
||||
|
||||
var entry = Assert.Single(await _store.AllAsync());
|
||||
Assert.Equal(ZaakId, entry.Id);
|
||||
@@ -112,7 +116,7 @@ public sealed class NotificationProjectorTests
|
||||
{
|
||||
var projector = Projector();
|
||||
await projector.HandleAsync(RecordWritten());
|
||||
await projector.HandleAsync(RecordWritten("update", status: RegistrationStatus.Ingeschreven));
|
||||
await projector.HandleAsync(RecordWritten("partial_update", status: RegistrationStatus.Ingeschreven));
|
||||
var callsAfterProjection = _acl.CallCount;
|
||||
|
||||
await projector.RebuildAsync();
|
||||
|
||||
Reference in New Issue
Block a user