DEV: Add spec for notification data modifier (#22223)

This commit is contained in:
Mark VanLandingham 2023-06-21 08:57:25 -05:00 committed by GitHub
parent 0de3b279ce
commit 114a9a10b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -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