From 0dd26a711ab7da8b7f3195a953bee0ff67caae22 Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Fri, 28 Aug 2026 13:39:03 +0200 Subject: [PATCH] test(event-subscriber): approval arrives as partial_update, not update (refs #153) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../NotificationProjectorTests.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/services/event-subscriber/EventSubscriber.Tests/NotificationProjectorTests.cs b/services/event-subscriber/EventSubscriber.Tests/NotificationProjectorTests.cs index 39e733b..a5cc37f 100644 --- a/services/event-subscriber/EventSubscriber.Tests/NotificationProjectorTests.cs +++ b/services/event-subscriber/EventSubscriber.Tests/NotificationProjectorTests.cs @@ -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();