@@ -6,6 +6,8 @@ const should = require("should");
66const Room = require ( "../../src/core/Room" ) ;
77const { KuzzleEventEmitter } = require ( "../../src/core/KuzzleEventEmitter" ) ;
88
9+ console . log ( Room ) ;
10+
911describe ( "Room" , ( ) => {
1012 const eventEmitter = new KuzzleEventEmitter ( ) ;
1113 const options = { opt : "in" } ;
@@ -39,7 +41,7 @@ describe("Room", () => {
3941
4042 controller . kuzzle . autoResubscribe = "default" ;
4143
42- const room = new Room (
44+ const room = new Room . default (
4345 controller ,
4446 "index" ,
4547 "collection" ,
@@ -83,7 +85,14 @@ describe("Room", () => {
8385 const body = { foo : "bar" } ;
8486 const cb = sinon . stub ( ) ;
8587
86- const room = new Room ( controller , "index" , "collection" , body , cb , opts ) ;
88+ const room = new Room . default (
89+ controller ,
90+ "index" ,
91+ "collection" ,
92+ body ,
93+ cb ,
94+ opts ,
95+ ) ;
8796
8897 should ( room . request . scope ) . be . equal ( "scope" ) ;
8998 should ( room . request . state ) . be . equal ( "state" ) ;
@@ -97,15 +106,36 @@ describe("Room", () => {
97106
98107 controller . kuzzle . autoResubscribe = "default" ;
99108
100- const room1 = new Room ( controller , "index" , "collection" , body , cb , {
101- autoResubscribe : true ,
102- } ) ;
103- const room2 = new Room ( controller , "index" , "collection" , body , cb , {
104- autoResubscribe : false ,
105- } ) ;
106- const room3 = new Room ( controller , "index" , "collection" , body , cb , {
107- autoResubscribe : "foobar" ,
108- } ) ;
109+ const room1 = new Room . default (
110+ controller ,
111+ "index" ,
112+ "collection" ,
113+ body ,
114+ cb ,
115+ {
116+ autoResubscribe : true ,
117+ } ,
118+ ) ;
119+ const room2 = new Room . default (
120+ controller ,
121+ "index" ,
122+ "collection" ,
123+ body ,
124+ cb ,
125+ {
126+ autoResubscribe : false ,
127+ } ,
128+ ) ;
129+ const room3 = new Room . default (
130+ controller ,
131+ "index" ,
132+ "collection" ,
133+ body ,
134+ cb ,
135+ {
136+ autoResubscribe : "foobar" ,
137+ } ,
138+ ) ;
109139
110140 should ( room1 . autoResubscribe ) . be . a . Boolean ( ) . and . be . True ( ) ;
111141 should ( room2 . autoResubscribe ) . be . a . Boolean ( ) . and . be . False ( ) ;
@@ -116,15 +146,36 @@ describe("Room", () => {
116146 const body = { foo : "bar" } ;
117147 const cb = sinon . stub ( ) ;
118148
119- const room1 = new Room ( controller , "index" , "collection" , body , cb , {
120- subscribeToSelf : true ,
121- } ) ;
122- const room2 = new Room ( controller , "index" , "collection" , body , cb , {
123- subscribeToSelf : false ,
124- } ) ;
125- const room3 = new Room ( controller , "index" , "collection" , body , cb , {
126- subscribeToSelf : "foobar" ,
127- } ) ;
149+ const room1 = new Room . default (
150+ controller ,
151+ "index" ,
152+ "collection" ,
153+ body ,
154+ cb ,
155+ {
156+ subscribeToSelf : true ,
157+ } ,
158+ ) ;
159+ const room2 = new Room . default (
160+ controller ,
161+ "index" ,
162+ "collection" ,
163+ body ,
164+ cb ,
165+ {
166+ subscribeToSelf : false ,
167+ } ,
168+ ) ;
169+ const room3 = new Room . default (
170+ controller ,
171+ "index" ,
172+ "collection" ,
173+ body ,
174+ cb ,
175+ {
176+ subscribeToSelf : "foobar" ,
177+ } ,
178+ ) ;
128179
129180 should ( room1 . subscribeToSelf ) . be . a . Boolean ( ) . and . be . True ( ) ;
130181 should ( room2 . subscribeToSelf ) . be . a . Boolean ( ) . and . be . False ( ) ;
@@ -154,7 +205,14 @@ describe("Room", () => {
154205 } ;
155206 const body = { foo : "bar" } ;
156207 const cb = sinon . stub ( ) ;
157- const room = new Room ( controller , "index" , "collection" , body , cb , opts ) ;
208+ const room = new Room . default (
209+ controller ,
210+ "index" ,
211+ "collection" ,
212+ body ,
213+ cb ,
214+ opts ,
215+ ) ;
158216
159217 return room . subscribe ( ) . then ( ( res ) => {
160218 should ( controller . kuzzle . query )
@@ -188,7 +246,14 @@ describe("Room", () => {
188246 } ;
189247 const body = { foo : "bar" } ;
190248 const cb = sinon . stub ( ) ;
191- const room = new Room ( controller , "index" , "collection" , body , cb , opts ) ;
249+ const room = new Room . default (
250+ controller ,
251+ "index" ,
252+ "collection" ,
253+ body ,
254+ cb ,
255+ opts ,
256+ ) ;
192257
193258 return room . subscribe ( ) . then ( ( ) => {
194259 should ( room . id ) . be . equal ( "my-room-id" ) ;
@@ -206,7 +271,14 @@ describe("Room", () => {
206271 } ;
207272 const body = { foo : "bar" } ;
208273 const cb = sinon . stub ( ) ;
209- const room = new Room ( controller , "index" , "collection" , body , cb , opts ) ;
274+ const room = new Room . default (
275+ controller ,
276+ "index" ,
277+ "collection" ,
278+ body ,
279+ cb ,
280+ opts ,
281+ ) ;
210282
211283 room . _channelListener = sinon . stub ( ) ;
212284
@@ -225,7 +297,7 @@ describe("Room", () => {
225297 let room ;
226298
227299 beforeEach ( ( ) => {
228- room = new Room (
300+ room = new Room . default (
229301 controller ,
230302 "index" ,
231303 "collection" ,
@@ -261,7 +333,7 @@ describe("Room", () => {
261333
262334 beforeEach ( ( ) => {
263335 cb = sinon . stub ( ) ;
264- room = new Room (
336+ room = new Room . default (
265337 controller ,
266338 "index" ,
267339 "collection" ,
0 commit comments