"use strict";var cov_h9a3mwwe1=function(){var path="/Users/josh.burman/Projects/braid/dist/server/test/channelBase.spec.js";var hash="1d390f7f6f20afb0b77ddae87a3c8c87eeb22334";var Function=function(){}.constructor;var global=new Function("return this")();var gcv="__coverage__";var coverageData={path:"/Users/josh.burman/Projects/braid/dist/server/test/channelBase.spec.js",statementMap:{"0":{start:{line:2,column:0},end:{line:2,column:62}},"1":{start:{line:3,column:21},end:{line:3,column:53}},"2":{start:{line:5,column:11},end:{line:5,column:40}},"3":{start:{line:6,column:13},end:{line:6,column:35}},"4":{start:{line:7,column:12},end:{line:7,column:28}},"5":{start:{line:8,column:16},end:{line:8,column:29}},"6":{start:{line:9,column:10},end:{line:9,column:34}},"7":{start:{line:10,column:13},end:{line:10,column:33}},"8":{start:{line:11,column:11},end:{line:11,column:25}},"9":{start:{line:12,column:10},end:{line:12,column:67}},"10":{start:{line:13,column:15},end:{line:13,column:33}},"11":{start:{line:15,column:11},end:{line:15,column:118}},"12":{start:{line:16,column:13},end:{line:16,column:53}},"13":{start:{line:17,column:0},end:{line:52,column:3}},"14":{start:{line:19,column:4},end:{line:22,column:7}},"15":{start:{line:20,column:8},end:{line:20,column:53}},"16":{start:{line:21,column:8},end:{line:21,column:45}},"17":{start:{line:23,column:4},end:{line:26,column:7}},"18":{start:{line:24,column:21},end:{line:24,column:46}},"19":{start:{line:25,column:8},end:{line:25,column:53}},"20":{start:{line:27,column:4},end:{line:30,column:7}},"21":{start:{line:28,column:21},end:{line:28,column:46}},"22":{start:{line:29,column:8},end:{line:29,column:52}},"23":{start:{line:31,column:4},end:{line:35,column:7}},"24":{start:{line:32,column:20},end:{line:32,column:51}},"25":{start:{line:33,column:21},end:{line:33,column:41}},"26":{start:{line:34,column:8},end:{line:34,column:41}},"27":{start:{line:36,column:4},end:{line:44,column:7}},"28":{start:{line:45,column:4},end:{line:51,column:7}},"29":{start:{line:49,column:21},end:{line:49,column:69}},"30":{start:{line:50,column:8},end:{line:50,column:53}}},fnMap:{"0":{name:"(anonymous_0)",decl:{start:{line:17,column:24},end:{line:17,column:25}},loc:{start:{line:17,column:36},end:{line:52,column:1}},line:17},"1":{name:"(anonymous_1)",decl:{start:{line:19,column:47},end:{line:19,column:48}},loc:{start:{line:19,column:59},end:{line:22,column:5}},line:19},"2":{name:"(anonymous_2)",decl:{start:{line:23,column:41},end:{line:23,column:42}},loc:{start:{line:23,column:53},end:{line:26,column:5}},line:23},"3":{name:"(anonymous_3)",decl:{start:{line:27,column:73},end:{line:27,column:74}},loc:{start:{line:27,column:85},end:{line:30,column:5}},line:27},"4":{name:"(anonymous_4)",decl:{start:{line:31,column:31},end:{line:31,column:32}},loc:{start:{line:31,column:43},end:{line:35,column:5}},line:31},"5":{name:"(anonymous_5)",decl:{start:{line:36,column:47},end:{line:36,column:48}},loc:{start:{line:36,column:59},end:{line:44,column:5}},line:36},"6":{name:"(anonymous_6)",decl:{start:{line:45,column:49},end:{line:45,column:50}},loc:{start:{line:45,column:61},end:{line:51,column:5}},line:45}},branchMap:{"0":{loc:{start:{line:33,column:21},end:{line:33,column:41}},type:"cond-expr",locations:[{start:{line:33,column:29},end:{line:33,column:33}},{start:{line:33,column:36},end:{line:33,column:41}}],line:33}},s:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0},f:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0},b:{"0":[0,0]},_coverageSchema:"43e27e138ebf9cfc5966b082cf9a028302ed4184"};var coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}coverageData.hash=hash;return coverage[path]=coverageData;}();cov_h9a3mwwe1.s[0]++;Object.defineProperty(exports,"__esModule",{value:true});const clientBase_1=(cov_h9a3mwwe1.s[1]++,require("../clients/clientBase"));// import ChannelManager from '../channelManager';
var exec=(cov_h9a3mwwe1.s[2]++,require('child_process').exec);var expect=(cov_h9a3mwwe1.s[3]++,require('chai').expect);var sinon=(cov_h9a3mwwe1.s[4]++,require('sinon'));var WebSocket=(cov_h9a3mwwe1.s[5]++,require('ws'));var app=(cov_h9a3mwwe1.s[6]++,require('../config/app'));var server=(cov_h9a3mwwe1.s[7]++,require('../server'));var name=(cov_h9a3mwwe1.s[8]++,'test channel');var url=(cov_h9a3mwwe1.s[9]++,`wss://${app.hostname}:${app.port}?token=${app.devToken}`);var wsClient=(cov_h9a3mwwe1.s[10]++,new WebSocket(url));var channel;var data=(cov_h9a3mwwe1.s[11]++,{'client':'test','client_type':'site','user_id':125,'user_type':'user','channel':'test channel'});var client=(cov_h9a3mwwe1.s[12]++,new clientBase_1.default(data,wsClient));cov_h9a3mwwe1.s[13]++;describe('ChannelBase',function(){cov_h9a3mwwe1.f[0]++;cov_h9a3mwwe1.s[14]++;// before ( function () { server.startServer; });
it('should create a class of ChannelBase',function(){cov_h9a3mwwe1.f[1]++;cov_h9a3mwwe1.s[15]++;channel=server.channelManager.sadsdf(name);cov_h9a3mwwe1.s[16]++;expect(channel.id).to.be.equal(name);});cov_h9a3mwwe1.s[17]++;it('should add a client to channel',function(){cov_h9a3mwwe1.f[2]++;var result=(cov_h9a3mwwe1.s[18]++,channel.addClient(client));cov_h9a3mwwe1.s[19]++;expect(result.status).to.be.equal('success');});cov_h9a3mwwe1.s[20]++;it('should find a client when trying to add said client to channel',function(){cov_h9a3mwwe1.f[3]++;var result=(cov_h9a3mwwe1.s[21]++,channel.addClient(client));cov_h9a3mwwe1.s[22]++;expect(result.status).to.be.equal('notice');});cov_h9a3mwwe1.s[23]++;it('should find a client',function(){cov_h9a3mwwe1.f[4]++;var exist=(cov_h9a3mwwe1.s[24]++,channel.clientExists(client.id));var result=(cov_h9a3mwwe1.s[25]++,exist?(cov_h9a3mwwe1.b[0][0]++,true):(cov_h9a3mwwe1.b[0][1]++,false));cov_h9a3mwwe1.s[26]++;expect(result).to.be.equal(true);});cov_h9a3mwwe1.s[27]++;it('should broadcast a message to others',function(){// var wstClient = new WebSocketClient();
// var teacher_data: any = { 'client': 'test', 'client_type':'site', 'user_id': 126, 'user_type': 'teacher', 'channel': name }
// var teacher: ClientBase = new ClientBase(teacher_data, wstClient);
// channel.addClient(client);
// channel.addClient(teacher);
// var result = channel.broadcastMessage(client, 'test message');
// expect(result.status).to.be.equal('success');
cov_h9a3mwwe1.f[5]++;});cov_h9a3mwwe1.s[28]++;it('should not broadcast a message to self',function(){cov_h9a3mwwe1.f[6]++;// var broadcastMessage = sinon.stub(channel, 'broadcastMessage').callsFake(function (client: ClientBase|null, message: string) {
//   return message;
// })
var result=(cov_h9a3mwwe1.s[29]++,channel.broadcastMessage(client,'test message'));cov_h9a3mwwe1.s[30]++;expect(result.status).to.be.equal('success');});});//# sourceMappingURL=channelBase.spec.js.map