@@ -29,130 +29,6 @@ describe("socket.io", () => {
29
29
expect ( version ) . to . be ( require ( "socket.io-client/package" ) . version ) ;
30
30
} ) ;
31
31
32
- describe ( "set" , ( ) => {
33
- it ( "should be able to set ping timeout to engine.io" , ( ) => {
34
- const srv = io ( http ( ) ) ;
35
- srv . set ( "heartbeat timeout" , 10 ) ;
36
- expect ( srv . eio . pingTimeout ) . to . be ( 10 ) ;
37
- } ) ;
38
-
39
- it ( "should be able to set ping interval to engine.io" , ( ) => {
40
- const srv = io ( http ( ) ) ;
41
- srv . set ( "heartbeat interval" , 10 ) ;
42
- expect ( srv . eio . pingInterval ) . to . be ( 10 ) ;
43
- } ) ;
44
-
45
- it ( "should be able to set transports to engine.io" , ( ) => {
46
- const srv = io ( http ( ) ) ;
47
- srv . set ( "transports" , [ "polling" ] ) ;
48
- expect ( srv . eio . transports ) . to . eql ( [ "polling" ] ) ;
49
- } ) ;
50
-
51
- it ( "should be able to set maxHttpBufferSize to engine.io" , ( ) => {
52
- const srv = io ( http ( ) ) ;
53
- srv . set ( "destroy buffer size" , 10 ) ;
54
- expect ( srv . eio . maxHttpBufferSize ) . to . eql ( 10 ) ;
55
- } ) ;
56
-
57
- it ( "should be able to set path with setting resource" , done => {
58
- const eio = io ( ) ;
59
- const srv = http ( ) ;
60
-
61
- eio . set ( "resource" , "/random" ) ;
62
- eio . attach ( srv ) ;
63
-
64
- // Check that the server is accessible through the specified path
65
- request ( srv )
66
- . get ( "/random/socket.io.js" )
67
- . buffer ( true )
68
- . end ( ( err , res ) => {
69
- if ( err ) return done ( err ) ;
70
- done ( ) ;
71
- } ) ;
72
- } ) ;
73
-
74
- it ( "should be able to set origins to engine.io" , ( ) => {
75
- const srv = io ( http ( ) ) ;
76
- srv . set ( "origins" , "http://hostname.com:*" ) ;
77
- expect ( srv . origins ( ) ) . to . be ( "http://hostname.com:*" ) ;
78
- } ) ;
79
-
80
- it ( "should be able to set authorization and send error packet" , done => {
81
- const httpSrv = http ( ) ;
82
- const srv = io ( httpSrv ) ;
83
- srv . set ( "authorization" , ( o , f ) => {
84
- f ( null , false ) ;
85
- } ) ;
86
-
87
- const socket = client ( httpSrv ) ;
88
- socket . on ( "connect" , ( ) => {
89
- expect ( ) . fail ( ) ;
90
- } ) ;
91
- socket . on ( "error" , err => {
92
- expect ( err ) . to . be ( "Not authorized" ) ;
93
- done ( ) ;
94
- } ) ;
95
- } ) ;
96
-
97
- it ( "should be able to set authorization and succeed" , done => {
98
- const httpSrv = http ( ) ;
99
- const srv = io ( httpSrv ) ;
100
- srv . set ( "authorization" , ( o , f ) => {
101
- f ( null , true ) ;
102
- } ) ;
103
-
104
- srv . on ( "connection" , s => {
105
- s . on ( "yoyo" , data => {
106
- expect ( data ) . to . be ( "data" ) ;
107
- done ( ) ;
108
- } ) ;
109
- } ) ;
110
-
111
- const socket = client ( httpSrv ) ;
112
- socket . on ( "connect" , ( ) => {
113
- socket . emit ( "yoyo" , "data" ) ;
114
- } ) ;
115
-
116
- socket . on ( "error" , err => {
117
- expect ( ) . fail ( ) ;
118
- } ) ;
119
- } ) ;
120
-
121
- it ( "should set the handshake BC object" , done => {
122
- const httpSrv = http ( ) ;
123
- const srv = io ( httpSrv ) ;
124
-
125
- srv . on ( "connection" , s => {
126
- expect ( s . handshake ) . to . not . be ( undefined ) ;
127
-
128
- // Headers set and has some valid properties
129
- expect ( s . handshake . headers ) . to . be . an ( "object" ) ;
130
- expect ( s . handshake . headers [ "user-agent" ] ) . to . be ( "node-XMLHttpRequest" ) ;
131
-
132
- // Time set and is valid looking string
133
- expect ( s . handshake . time ) . to . be . a ( "string" ) ;
134
- expect ( s . handshake . time . split ( " " ) . length > 0 ) ; // Is "multipart" string representation
135
-
136
- // Address, xdomain, secure, issued and url set
137
- expect ( s . handshake . address ) . to . contain ( "127.0.0.1" ) ;
138
- expect ( s . handshake . xdomain ) . to . be . a ( "boolean" ) ;
139
- expect ( s . handshake . secure ) . to . be . a ( "boolean" ) ;
140
- expect ( s . handshake . issued ) . to . be . a ( "number" ) ;
141
- expect ( s . handshake . url ) . to . be . a ( "string" ) ;
142
-
143
- // Query set and has some right properties
144
- expect ( s . handshake . query ) . to . be . an ( "object" ) ;
145
- expect ( s . handshake . query . EIO ) . to . not . be ( undefined ) ;
146
- expect ( s . handshake . query . transport ) . to . not . be ( undefined ) ;
147
- expect ( s . handshake . query . t ) . to . not . be ( undefined ) ;
148
-
149
- done ( ) ;
150
- } ) ;
151
-
152
- const socket = client ( httpSrv ) ;
153
- } ) ;
154
- } ) ;
155
-
156
32
describe ( "server attachment" , ( ) => {
157
33
describe ( "http.Server" , ( ) => {
158
34
const clientVersion = require ( "socket.io-client/package" ) . version ;
0 commit comments