Skip to content
Snippets Groups Projects
Commit f024f6b8 authored by Serene Han's avatar Serene Han Committed by Arlo Breault
Browse files

create and removing from webrtcRemotes test

parent b2d7586c
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,7 @@ func (m *MockTransport) RoundTrip(req *http.Request) (*http.Response, error) {
func TestConnect(t *testing.T) {
Convey("Snowflake", t, func() {
webrtcRemotes = make(map[int]*webRTCConn)
Convey("WebRTC Connection", func() {
c := new(webRTCConn)
......@@ -58,6 +59,19 @@ func TestConnect(t *testing.T) {
}
So(c.buffer.Bytes(), ShouldEqual, nil)
Convey("Create and remove from WebRTCConn set", func() {
So(len(webrtcRemotes), ShouldEqual, 0)
So(remoteIndex, ShouldEqual, 0)
s := NewWebRTCConnection(nil, nil)
So(s, ShouldNotBeNil)
So(s.index, ShouldEqual, 0)
So(len(webrtcRemotes), ShouldEqual, 1)
So(remoteIndex, ShouldEqual, 1)
s.Close()
So(len(webrtcRemotes), ShouldEqual, 0)
So(remoteIndex, ShouldEqual, 1)
})
Convey("Write buffers when datachannel is nil", func() {
c.Write([]byte("test"))
c.snowflake = nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment