From 114a9a10b7e089d47717a9153da34a4af68e396f Mon Sep 17 00:00:00 2001 From: Mark VanLandingham Date: Wed, 21 Jun 2023 08:57:25 -0500 Subject: [PATCH] DEV: Add spec for notification data modifier (#22223) --- spec/services/post_alerter_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rb index fe3b95bf49a..69d78c4659d 100644 --- a/spec/services/post_alerter_spec.rb +++ b/spec/services/post_alerter_spec.rb @@ -1150,6 +1150,20 @@ RSpec.describe PostAlerter do params: [user, type, post, { revision_number: 1 }], ) end + + it "applies modifiers to notification_data" do + Plugin::Instance + .new + .register_modifier(:notification_data) do |notification_data| + notification_data[:silly_key] = "silly value" + notification_data + end + + notification = PostAlerter.new.create_notification(user, type, post) + expect(notification.data_hash[:silly_key]).to eq("silly value") + + DiscoursePluginRegistry.clear_modifiers! + end end describe ".push_notification" do