mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 10:41:15 +00:00
wip unit tests
This commit is contained in:
parent
a538d10488
commit
9f7df5f10c
2 changed files with 70 additions and 0 deletions
33
services/real-time/test/unit/coffee/ChannelManager.coffee
Normal file
33
services/real-time/test/unit/coffee/ChannelManager.coffee
Normal file
|
@ -0,0 +1,33 @@
|
|||
chai = require('chai')
|
||||
should = chai.should()
|
||||
sinon = require("sinon")
|
||||
modulePath = "../../../app/js/ChannelManager.js"
|
||||
SandboxedModule = require('sandboxed-module')
|
||||
|
||||
describe 'ChannelManager', ->
|
||||
beforeEach ->
|
||||
@project_id = "project-id-123"
|
||||
@user_id = "user-id-123"
|
||||
@user = {_id: @user_id}
|
||||
@callback = sinon.stub()
|
||||
@ChannelManager = SandboxedModule.require modulePath, requires:
|
||||
"settings-sharelatex": @settings = {}
|
||||
"logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub() }
|
||||
|
||||
describe "subscribe", ->
|
||||
|
||||
describe "when the project room is empty", ->
|
||||
|
||||
describe "when there are other clients in the project room", ->
|
||||
|
||||
describe "unsubscribe", ->
|
||||
|
||||
describe "when the doc room is empty", ->
|
||||
|
||||
describe "when there are other clients in the doc room", ->
|
||||
|
||||
describe "publish", ->
|
||||
|
||||
describe "when the channel is 'all'", ->
|
||||
|
||||
describe "when the channel has an specific id", ->
|
37
services/real-time/test/unit/coffee/RoomManagerTests.coffee
Normal file
37
services/real-time/test/unit/coffee/RoomManagerTests.coffee
Normal file
|
@ -0,0 +1,37 @@
|
|||
chai = require('chai')
|
||||
should = chai.should()
|
||||
sinon = require("sinon")
|
||||
modulePath = "../../../app/js/RoomManager.js"
|
||||
SandboxedModule = require('sandboxed-module')
|
||||
|
||||
describe 'RoomManager', ->
|
||||
beforeEach ->
|
||||
@project_id = "project-id-123"
|
||||
@user_id = "user-id-123"
|
||||
@user = {_id: @user_id}
|
||||
@callback = sinon.stub()
|
||||
@RoomManager = SandboxedModule.require modulePath, requires:
|
||||
"settings-sharelatex": @settings = {}
|
||||
"logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub() }
|
||||
|
||||
describe "joinProject", ->
|
||||
|
||||
describe "when the project room is empty", ->
|
||||
|
||||
describe "when there are other clients in the project room", ->
|
||||
|
||||
describe "joinDoc", ->
|
||||
|
||||
describe "when the doc room is empty", ->
|
||||
|
||||
describe "when there are other clients in the doc room", ->
|
||||
|
||||
describe "leaveDoc", ->
|
||||
|
||||
describe "when doc room will be empty after this client has left", ->
|
||||
|
||||
describe "when there are other clients in the doc room", ->
|
||||
|
||||
describe "leaveProjectAndDocs", ->
|
||||
|
||||
describe "when the client is connected to multiple docs", ->
|
Loading…
Reference in a new issue