|
@@ -15,22 +15,28 @@ describe "clientTracking", ->
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
FixturesManager.setUpProject {
|
|
FixturesManager.setUpProject {
|
|
|
privilegeLevel: "owner"
|
|
privilegeLevel: "owner"
|
|
|
- project: { name: "Test Project" }
|
|
|
|
|
|
|
+ project: { name: "Test Project" }
|
|
|
}, (error, {@user_id, @project_id}) => cb()
|
|
}, (error, {@user_id, @project_id}) => cb()
|
|
|
|
|
|
|
|
|
|
+ (cb) =>
|
|
|
|
|
+ FixturesManager.setUpDoc @project_id, {@lines, @version, @ops}, (e, {@doc_id}) =>
|
|
|
|
|
+ cb(e)
|
|
|
|
|
+
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
@clientA = RealTimeClient.connect()
|
|
@clientA = RealTimeClient.connect()
|
|
|
- @clientA.on "connect", cb
|
|
|
|
|
|
|
+ @clientA.on "connectionAccepted", cb
|
|
|
|
|
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
@clientB = RealTimeClient.connect()
|
|
@clientB = RealTimeClient.connect()
|
|
|
-
|
|
|
|
|
- @clientB.on "connect", cb
|
|
|
|
|
|
|
+ @clientB.on "connectionAccepted", cb
|
|
|
|
|
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
@clientA.emit "joinProject", {
|
|
@clientA.emit "joinProject", {
|
|
|
project_id: @project_id
|
|
project_id: @project_id
|
|
|
}, cb
|
|
}, cb
|
|
|
|
|
+
|
|
|
|
|
+ (cb) =>
|
|
|
|
|
+ @clientA.emit "joinDoc", @doc_id, cb
|
|
|
|
|
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
@clientB.emit "joinProject", {
|
|
@clientB.emit "joinProject", {
|
|
@@ -45,7 +51,7 @@ describe "clientTracking", ->
|
|
|
@clientA.emit "clientTracking.updatePosition", {
|
|
@clientA.emit "clientTracking.updatePosition", {
|
|
|
row: @row = 42
|
|
row: @row = 42
|
|
|
column: @column = 36
|
|
column: @column = 36
|
|
|
- doc_id: @doc_id = "mock-doc-id"
|
|
|
|
|
|
|
+ doc_id: @doc_id
|
|
|
}, (error) ->
|
|
}, (error) ->
|
|
|
throw error if error?
|
|
throw error if error?
|
|
|
setTimeout cb, 300 # Give the message a chance to reach client B.
|
|
setTimeout cb, 300 # Give the message a chance to reach client B.
|
|
@@ -85,9 +91,14 @@ describe "clientTracking", ->
|
|
|
publicAccess: "readAndWrite"
|
|
publicAccess: "readAndWrite"
|
|
|
}, (error, {@user_id, @project_id}) => cb()
|
|
}, (error, {@user_id, @project_id}) => cb()
|
|
|
|
|
|
|
|
|
|
+ (cb) =>
|
|
|
|
|
+ FixturesManager.setUpDoc @project_id, {@lines, @version, @ops}, (e, {@doc_id}) =>
|
|
|
|
|
+ cb(e)
|
|
|
|
|
+
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
@clientA = RealTimeClient.connect()
|
|
@clientA = RealTimeClient.connect()
|
|
|
- @clientA.on "connect", cb
|
|
|
|
|
|
|
+ @clientA.on "connectionAccepted", cb
|
|
|
|
|
+
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
@clientA.emit "joinProject", {
|
|
@clientA.emit "joinProject", {
|
|
|
project_id: @project_id
|
|
project_id: @project_id
|
|
@@ -98,12 +109,15 @@ describe "clientTracking", ->
|
|
|
|
|
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
@anonymous = RealTimeClient.connect()
|
|
@anonymous = RealTimeClient.connect()
|
|
|
- @anonymous.on "connect", cb
|
|
|
|
|
|
|
+ @anonymous.on "connectionAccepted", cb
|
|
|
|
|
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
@anonymous.emit "joinProject", {
|
|
@anonymous.emit "joinProject", {
|
|
|
project_id: @project_id
|
|
project_id: @project_id
|
|
|
}, cb
|
|
}, cb
|
|
|
|
|
+
|
|
|
|
|
+ (cb) =>
|
|
|
|
|
+ @anonymous.emit "joinDoc", @doc_id, cb
|
|
|
|
|
|
|
|
(cb) =>
|
|
(cb) =>
|
|
|
@updates = []
|
|
@updates = []
|
|
@@ -113,7 +127,7 @@ describe "clientTracking", ->
|
|
|
@anonymous.emit "clientTracking.updatePosition", {
|
|
@anonymous.emit "clientTracking.updatePosition", {
|
|
|
row: @row = 42
|
|
row: @row = 42
|
|
|
column: @column = 36
|
|
column: @column = 36
|
|
|
- doc_id: @doc_id = "mock-doc-id"
|
|
|
|
|
|
|
+ doc_id: @doc_id
|
|
|
}, (error) ->
|
|
}, (error) ->
|
|
|
throw error if error?
|
|
throw error if error?
|
|
|
setTimeout cb, 300 # Give the message a chance to reach client B.
|
|
setTimeout cb, 300 # Give the message a chance to reach client B.
|