mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
47 lines
No EOL
1.1 KiB
CoffeeScript
47 lines
No EOL
1.1 KiB
CoffeeScript
chai = require("chai")
|
|
expect = chai.expect
|
|
|
|
RealTimeClient = require "./helpers/RealTimeClient"
|
|
|
|
describe "Session", ->
|
|
describe "with an established session", ->
|
|
beforeEach (done) ->
|
|
RealTimeClient.setSession {
|
|
user: { _id: @user_id }
|
|
}, (error) =>
|
|
throw error if error?
|
|
@client = RealTimeClient.connect()
|
|
done()
|
|
|
|
it "should not get disconnected", (done) ->
|
|
disconnected = false
|
|
@client.on "disconnect", () ->
|
|
disconnected = true
|
|
setTimeout () =>
|
|
expect(disconnected).to.equal false
|
|
done()
|
|
, 500
|
|
|
|
describe "without an established session", ->
|
|
beforeEach (done) ->
|
|
RealTimeClient.unsetSession (error) =>
|
|
throw error if error?
|
|
@client = RealTimeClient.connect()
|
|
done()
|
|
|
|
it "should get disconnected", (done) ->
|
|
@client.on "disconnect", () ->
|
|
done()
|
|
|
|
describe "with a user set on the session", ->
|
|
beforeEach (done) ->
|
|
RealTimeClient.setSession {
|
|
foo: "bar"
|
|
}, (error) =>
|
|
throw error if error?
|
|
@client = RealTimeClient.connect()
|
|
done()
|
|
|
|
it "should get disconnected", (done) ->
|
|
@client.on "disconnect", () ->
|
|
done() |