aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/plum/client/test_connection.rb1
-rw-r--r--test/plum/test_frame_factory.rb37
2 files changed, 38 insertions, 0 deletions
diff --git a/test/plum/client/test_connection.rb b/test/plum/client/test_connection.rb
index b539d77..204eb3a 100644
--- a/test/plum/client/test_connection.rb
+++ b/test/plum/client/test_connection.rb
@@ -7,5 +7,6 @@ class ClientConnectionTest < Minitest::Test
stream = con.open_stream(weight: 256)
assert(stream.id % 2 == 1)
assert_equal(256, stream.weight)
+ assert_equal(:idle, stream.state)
end
end
diff --git a/test/plum/test_frame_factory.rb b/test/plum/test_frame_factory.rb
index ff8e67f..ccaa56c 100644
--- a/test/plum/test_frame_factory.rb
+++ b/test/plum/test_frame_factory.rb
@@ -53,4 +53,41 @@ class FrameFactoryTest < Minitest::Test
flags: [:ack],
payload: "12345678")
end
+
+ def test_continuation
+ frame = Frame.continuation(123, "abc", :end_headers)
+ assert_frame(frame,
+ type: :continuation,
+ stream_id: 123,
+ flags: [:end_headers],
+ payload: "abc")
+ end
+
+ def test_data
+ frame = Frame.data(123, "abc".force_encoding("UTF-8"))
+ assert_frame(frame,
+ type: :data,
+ stream_id: 123,
+ flags: [],
+ payload: "abc")
+ assert_equal(Encoding::BINARY, frame.payload.encoding)
+ end
+
+ def test_headers
+ frame = Frame.headers(123, "abc", :end_stream)
+ assert_frame(frame,
+ type: :headers,
+ stream_id: 123,
+ flags: [:end_stream],
+ payload: "abc")
+ end
+
+ def test_push_promise
+ frame = Frame.push_promise(345, 2, "abc", :end_headers)
+ assert_frame(frame,
+ type: :push_promise,
+ stream_id: 345,
+ flags: [:end_headers],
+ payload: "\x00\x00\x00\x02abc")
+ end
end