test(port-out-pin): complete success sets pin

Phillip Davis created

Change summary

test/property/test_port_out_pin.rb | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Detailed changes

test/property/test_port_out_pin.rb 🔗

@@ -52,4 +52,29 @@ class PortOutPinPropertyTest < Minitest::Test
 		}
 	end
 	em :test_execute_rejects_unregistered_user
+
+	def test_complete_success_sets_pin
+		property_of {
+			PortOutPinCompleteCmd.new(REDIS).generate
+		}.check { |_metadata, example|
+			BandwidthTNOptions.stub(
+				:set_port_out_pin,
+				EMPromise.resolve(nil)
+			) do
+				process_stanza(example['stanza'])
+			end
+
+			assert_equal 1, written.length
+			reply = written.shift
+
+			assert_equal example['jid'], reply.to.to_s
+			assert_equal :completed, reply.status
+			assert_equal 'set-port-out-pin', reply.node
+			ns = 'http://jabber.org/protocol/commands'
+			note = reply.find('.//ns:note', ns: ns).first
+			assert_equal 'info', note[:type]
+			assert_equal 'Port-out PIN has been set successfully.', note.content
+		}
+	end
+	em :test_complete_success_sets_pin
 end