diff --git a/test/property/test_webhook_handler.rb b/test/property/test_webhook_handler.rb index ac650a9d2aa88c31848c71581c96b06780566e70..5d99eaf9cf468c6adb08c57b41fab2c2e0eb8382 100644 --- a/test/property/test_webhook_handler.rb +++ b/test/property/test_webhook_handler.rb @@ -139,4 +139,27 @@ class WebhookPropertyTest < Minitest::Test } end em :test_unknown_outbound_returns_200 + + def test_unknown_direction_returns_400_ok_except_when_message_failed + property_of { + Webhook + .new(REDIS) + .direction { "unknown" } + .type { + choose(*(Webhook::INBOUND_TYPES << Webhook::OUTBOUND_TYPES) + .reject { |ty| + ty == "message-failed" + } + ) + } + .generate + }.check { |metadata, example| + result = invoke_webhook(example) + assert_equal [400, {}, "OK"], result + assert_empty written + entries = REDIS.stream_entries("messages").sync + assert_empty entries + } + end + em :test_unknown_direction_returns_400_ok_except_when_message_failed end