From 9f7df5f10c5b1692f8b7b2429e5e605fb0950fd9 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 19 Jul 2019 11:58:40 +0100 Subject: [PATCH] wip unit tests --- .../test/unit/coffee/ChannelManager.coffee | 33 +++++++++++++++++ .../test/unit/coffee/RoomManagerTests.coffee | 37 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 services/real-time/test/unit/coffee/ChannelManager.coffee create mode 100644 services/real-time/test/unit/coffee/RoomManagerTests.coffee diff --git a/services/real-time/test/unit/coffee/ChannelManager.coffee b/services/real-time/test/unit/coffee/ChannelManager.coffee new file mode 100644 index 0000000000..314e9914e1 --- /dev/null +++ b/services/real-time/test/unit/coffee/ChannelManager.coffee @@ -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", -> diff --git a/services/real-time/test/unit/coffee/RoomManagerTests.coffee b/services/real-time/test/unit/coffee/RoomManagerTests.coffee new file mode 100644 index 0000000000..75d241cf6b --- /dev/null +++ b/services/real-time/test/unit/coffee/RoomManagerTests.coffee @@ -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", -> \ No newline at end of file