Respect new Lightning notification settings
This commit is contained in:
@@ -101,6 +101,34 @@ RSpec.describe "Webhooks", type: :request do
|
||||
expect(args[3]["params"]["amount_sats"]).to eq(12300)
|
||||
end
|
||||
end
|
||||
|
||||
describe "minimum threshold amount not reached" do
|
||||
before do
|
||||
user.update! preferences: {
|
||||
lightning_notify_sats_received: "xmpp",
|
||||
lightning_notify_min_sats: 21000
|
||||
}
|
||||
end
|
||||
|
||||
it "does not send a notification" do
|
||||
post "/webhooks/lndhub", params: payload.to_json
|
||||
expect(enqueued_jobs.size).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
describe "no memo/description/message" do
|
||||
before do
|
||||
user.update! preferences: {
|
||||
lightning_notify_sats_received: "xmpp",
|
||||
lightning_notify_only_with_message: true
|
||||
}
|
||||
end
|
||||
|
||||
it "does not send a notification" do
|
||||
post "/webhooks/lndhub", params: payload.merge({ memo: "" }).to_json
|
||||
expect(enqueued_jobs.size).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "Valid payload for zap transaction" do
|
||||
@@ -149,6 +177,17 @@ RSpec.describe "Webhooks", type: :request do
|
||||
expect(NostrManager::PublishZapReceipt).to receive(:call).with(zap: zap)
|
||||
post "/webhooks/lndhub", params: payload.to_json
|
||||
end
|
||||
|
||||
context "with notifications disabled for zaps" do
|
||||
before do
|
||||
user.update! preferences: { lightning_notify_zap_received: "disabled" }
|
||||
end
|
||||
|
||||
it "does not send a notification" do
|
||||
post "/webhooks/lndhub", params: payload.to_json
|
||||
expect(enqueued_jobs.size).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user