UNPKG

@superhero/websocket

Version:
2 lines 17 kB
<!doctype html> <html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Mochawesome Report</title><link rel="stylesheet" href="assets/app.css"/></head><body data-raw="{&quot;stats&quot;:{&quot;suites&quot;:4,&quot;tests&quot;:13,&quot;passes&quot;:13,&quot;pending&quot;:0,&quot;failures&quot;:0,&quot;start&quot;:&quot;2018-05-10T12:50:41.503Z&quot;,&quot;end&quot;:&quot;2018-05-10T12:50:41.577Z&quot;,&quot;duration&quot;:74,&quot;testsRegistered&quot;:13,&quot;passPercent&quot;:100,&quot;pendingPercent&quot;:0,&quot;other&quot;:0,&quot;hasOther&quot;:false,&quot;skipped&quot;:0,&quot;hasSkipped&quot;:false,&quot;passPercentClass&quot;:&quot;success&quot;,&quot;pendingPercentClass&quot;:&quot;danger&quot;},&quot;suites&quot;:{&quot;uuid&quot;:&quot;0da25e5a-e24d-4c09-8deb-68bc73d56596&quot;,&quot;title&quot;:&quot;&quot;,&quot;fullFile&quot;:&quot;&quot;,&quot;file&quot;:&quot;&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[],&quot;tests&quot;:[],&quot;suites&quot;:[{&quot;uuid&quot;:&quot;2823deb9-7a55-4f59-9a85-52ad76d97ada&quot;,&quot;title&quot;:&quot;codec tests&quot;,&quot;fullFile&quot;:&quot;/home/erik/Projects/@superhero/js.websocket/test.js&quot;,&quot;file&quot;:&quot;/test.js&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[],&quot;tests&quot;:[{&quot;title&quot;:&quot;expect guid to be the corect constant&quot;,&quot;fullTitle&quot;:&quot;codec tests expect guid to be the corect constant&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:1,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;expect(Codec.GUID).to.be.equal(&#x27;258EAFA5-E914-47DA-95CA-C5AB0DC85B11&#x27;)&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;44ea3aa1-4f16-480f-b9e9-9dec5f7a6ba9&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;possible to decode an encoded string&quot;,&quot;fullTitle&quot;:&quot;codec tests possible to decode an encoded string&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:7,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const\noriginal = &#x27;foobar&#x27;,\nencoded = Codec.encode(original)\nfor(const decoded of Codec.decode(encoded))\n{\n expect(decoded.msg).to.be.equal(original)\n done()\n}&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;db017562-898c-4ff3-8055-c8b93d0a07b6&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;possible to decode an encoded string with mask&quot;,&quot;fullTitle&quot;:&quot;codec tests possible to decode an encoded string with mask&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:0,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const\noriginal = &#x27;foobar&#x27;,\nmasked = true,\nencoded = Codec.encode(original, masked)\nfor(const decoded of Codec.decode(encoded))\n{\n expect(decoded.msg).to.be.equal(original)\n done()\n}&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;06907cf3-cd14-4701-9002-7299322c36f1&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;buffer is empty after processed complete message&quot;,&quot;fullTitle&quot;:&quot;codec tests buffer is empty after processed complete message&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:0,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const\noriginal = &#x27;foobar&#x27;,\nencoded = Codec.encode(original)\nfor(const decoded of Codec.decode(encoded))\n{\n expect(decoded.buffer.length).to.be.equal(0)\n done()\n}&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;c815146a-47fc-49d0-a615-c7cb5b27bd4f&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false}],&quot;suites&quot;:[],&quot;passes&quot;:[&quot;44ea3aa1-4f16-480f-b9e9-9dec5f7a6ba9&quot;,&quot;db017562-898c-4ff3-8055-c8b93d0a07b6&quot;,&quot;06907cf3-cd14-4701-9002-7299322c36f1&quot;,&quot;c815146a-47fc-49d0-a615-c7cb5b27bd4f&quot;],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:8,&quot;root&quot;:false,&quot;rootEmpty&quot;:false,&quot;_timeout&quot;:2000},{&quot;uuid&quot;:&quot;8cbb71cf-b661-4cec-a7ee-6af787c23103&quot;,&quot;title&quot;:&quot;server setup tests&quot;,&quot;fullFile&quot;:&quot;/home/erik/Projects/@superhero/js.websocket/test.js&quot;,&quot;file&quot;:&quot;/test.js&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[],&quot;tests&quot;:[{&quot;title&quot;:&quot;possible for the server to listen to a port&quot;,&quot;fullTitle&quot;:&quot;server setup tests possible for the server to listen to a port&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:3,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const WebsocketServer = require(&#x27;./server&#x27;)\nserver = new WebsocketServer({ debug:false })\nserver.server.on(&#x27;listening&#x27;, done)\nserver.server.listen({ port:9001 })&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;4f22fd4e-d7c1-42c8-a924-c69742877fa7&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;possible to close the server connection&quot;,&quot;fullTitle&quot;:&quot;server setup tests possible to close the server connection&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:0,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;server.server.on(&#x27;close&#x27;, done)\nserver.server.close()&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;acce1549-3cba-4aec-a232-019ab4f05f21&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false}],&quot;suites&quot;:[],&quot;passes&quot;:[&quot;4f22fd4e-d7c1-42c8-a924-c69742877fa7&quot;,&quot;acce1549-3cba-4aec-a232-019ab4f05f21&quot;],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:3,&quot;root&quot;:false,&quot;rootEmpty&quot;:false,&quot;_timeout&quot;:2000},{&quot;uuid&quot;:&quot;cbe876c1-a173-4f0b-940e-580c75614abf&quot;,&quot;title&quot;:&quot;client setup tests&quot;,&quot;fullFile&quot;:&quot;/home/erik/Projects/@superhero/js.websocket/test.js&quot;,&quot;file&quot;:&quot;/test.js&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[{&quot;title&quot;:&quot;\&quot;after all\&quot; hook&quot;,&quot;fullTitle&quot;:&quot;client setup tests \&quot;after all\&quot; hook&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:0,&quot;pass&quot;:false,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;server.server.close()&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;6391ba6c-0735-44d0-a314-d51fb2aabcf1&quot;,&quot;isHook&quot;:true,&quot;skipped&quot;:false}],&quot;tests&quot;:[{&quot;title&quot;:&quot;possible for the client to connect to the server&quot;,&quot;fullTitle&quot;:&quot;client setup tests possible for the client to connect to the server&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:4,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const\nWebsocketClient = require(&#x27;./client&#x27;),\nWebsocketServer = require(&#x27;./server&#x27;),\nport = 9001\n// let\nclient = new WebsocketClient({ debug:false })\nserver = new WebsocketServer({ debug:false })\nserver.server.on(&#x27;listening&#x27;, async () =&gt;\n{\n await client.connect(port)\n done()\n})\nserver.server.listen({ port })&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;d5c4a306-4b66-481b-9a40-447b64427088&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;possible to close the client connection&quot;,&quot;fullTitle&quot;:&quot;client setup tests possible to close the client connection&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:1,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;client.socket.on(&#x27;close&#x27;, done)\nclient.socket.end()&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;278ef251-9b6a-440d-9d54-94adea7613dc&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false}],&quot;suites&quot;:[],&quot;passes&quot;:[&quot;d5c4a306-4b66-481b-9a40-447b64427088&quot;,&quot;278ef251-9b6a-440d-9d54-94adea7613dc&quot;],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:5,&quot;root&quot;:false,&quot;rootEmpty&quot;:false,&quot;_timeout&quot;:2000},{&quot;uuid&quot;:&quot;0c15fdb5-5d9b-4c33-a5ba-c58bc51c67e1&quot;,&quot;title&quot;:&quot;integration tests&quot;,&quot;fullFile&quot;:&quot;/home/erik/Projects/@superhero/js.websocket/test.js&quot;,&quot;file&quot;:&quot;/test.js&quot;,&quot;beforeHooks&quot;:[{&quot;title&quot;:&quot;\&quot;before each\&quot; hook&quot;,&quot;fullTitle&quot;:&quot;integration tests \&quot;before each\&quot; hook&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:0,&quot;pass&quot;:false,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const\nWebsocketClient = require(&#x27;./client&#x27;),\nWebsocketServer = require(&#x27;./server&#x27;),\nport = 9001\n// let\nserver = new WebsocketServer({ debug:false })\nclient = new WebsocketClient({ debug:false })\nserver.server.listen({ port })\nserver.server.on(&#x27;listening&#x27;, async () =&gt;\n{\n await client.connect(port)\n done()\n})&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;bd25aee8-6d89-46fa-addf-a9807ee1032a&quot;,&quot;isHook&quot;:true,&quot;skipped&quot;:false}],&quot;afterHooks&quot;:[{&quot;title&quot;:&quot;\&quot;after each\&quot; hook&quot;,&quot;fullTitle&quot;:&quot;integration tests \&quot;after each\&quot; hook&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:0,&quot;pass&quot;:false,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;client.socket.end()\nserver.server.close()&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;0a644a02-b66f-4d93-9baa-d4505754eb6d&quot;,&quot;isHook&quot;:true,&quot;skipped&quot;:false}],&quot;tests&quot;:[{&quot;title&quot;:&quot;not possible to emit an event that is not a string&quot;,&quot;fullTitle&quot;:&quot;integration tests not possible to emit an event that is not a string&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:1,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;expect(client.emit.bind(client, [] )).to.throw(TypeError)\nexpect(client.emit.bind(client, {} )).to.throw(TypeError)\nexpect(client.emit.bind(client, 1234)).to.throw(TypeError)\nexpect(client.emit.bind(client, null)).to.throw(TypeError)&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;3ee1828c-c0a8-4f63-8a37-9d24e7a56d32&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;possible to emit an event from the client to the server&quot;,&quot;fullTitle&quot;:&quot;integration tests possible to emit an event from the client to the server&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:0,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const\nevt = &#x27;foo&#x27;,\ndto = &#x27;bar&#x27;\nserver.events.on(evt, (ctx, data) =&gt;\n{\n expect(data).to.be.equal(dto)\n done()\n})\nclient.emit(evt, dto)&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;ecfb2c28-97d2-4739-ba30-e9e282d50af1&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;possible to emit less then 125 char message&quot;,&quot;fullTitle&quot;:&quot;integration tests possible to emit less then 125 char message&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:1,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const\nevt1 = &#x27;foo&#x27;,\nevt2 = &#x27;bar&#x27;,\ndto1 = &#x27;baz&#x27;,\ndto2 = &#x27;qux&#x27;\nserver.events.on(evt1, (ctx, dto) =&gt;\n{\n expect(dto).to.be.equal(dto1)\n ctx.emit(evt2, dto2)\n})\nclient.events.on(evt2, (dto) =&gt;\n{\n expect(dto).to.be.equal(dto2)\n done()\n})\nclient.emit(evt1, dto1)&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;42d50a3d-7168-4209-90af-681de8ec24da&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;possible to emit a message larger then 125 and less then 65535&quot;,&quot;fullTitle&quot;:&quot;integration tests possible to emit a message larger then 125 and less then 65535&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:0,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const\nevt1 = &#x27;foo&#x27;.repeat(125),\nevt2 = &#x27;bar&#x27;.repeat(125),\ndto1 = &#x27;baz&#x27;.repeat(125),\ndto2 = &#x27;qux&#x27;.repeat(125)\nserver.events.on(evt1, (ctx, dto) =&gt;\n{\n expect(dto).to.be.equal(dto1)\n ctx.emit(evt2, dto2)\n})\nclient.events.on(evt2, (dto) =&gt;\n{\n expect(dto).to.be.equal(dto2)\n done()\n})\nclient.emit(evt1, dto1)&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;f0426c44-a47d-4539-b5ca-35d43dfa240a&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;possible to emit a message larger then 65535 chars&quot;,&quot;fullTitle&quot;:&quot;integration tests possible to emit a message larger then 65535 chars&quot;,&quot;timedOut&quot;:false,&quot;duration&quot;:7,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;code&quot;:&quot;const\nevt1 = &#x27;foo&#x27;.repeat(13107),\nevt2 = &#x27;bar&#x27;.repeat(13107),\ndto1 = &#x27;baz&#x27;.repeat(13107),\ndto2 = &#x27;qux&#x27;.repeat(13107)\nserver.events.on(evt1, (ctx, dto) =&gt;\n{\n expect(dto).to.be.equal(dto1)\n ctx.emit(evt2, dto2)\n})\nclient.events.on(evt2, (dto) =&gt;\n{\n expect(dto).to.be.equal(dto2)\n done()\n})\nclient.emit(evt1, dto1)&quot;,&quot;err&quot;:{},&quot;isRoot&quot;:false,&quot;uuid&quot;:&quot;b5a0b651-d58a-4842-a34b-e1016b73c21e&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false}],&quot;suites&quot;:[],&quot;passes&quot;:[&quot;3ee1828c-c0a8-4f63-8a37-9d24e7a56d32&quot;,&quot;ecfb2c28-97d2-4739-ba30-e9e282d50af1&quot;,&quot;42d50a3d-7168-4209-90af-681de8ec24da&quot;,&quot;f0426c44-a47d-4539-b5ca-35d43dfa240a&quot;,&quot;b5a0b651-d58a-4842-a34b-e1016b73c21e&quot;],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:9,&quot;root&quot;:false,&quot;rootEmpty&quot;:false,&quot;_timeout&quot;:2000}],&quot;passes&quot;:[],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:0,&quot;root&quot;:true,&quot;rootEmpty&quot;:true,&quot;_timeout&quot;:2000},&quot;copyrightYear&quot;:2018}" data-config="{&quot;reportFilename&quot;:&quot;index&quot;,&quot;reportDir&quot;:&quot;docs/tests&quot;,&quot;reportTitle&quot;:&quot;js.websocket&quot;,&quot;reportPageTitle&quot;:&quot;Mochawesome Report&quot;,&quot;inline&quot;:false,&quot;inlineAssets&quot;:false,&quot;cdn&quot;:false,&quot;charts&quot;:true,&quot;enableCharts&quot;:true,&quot;code&quot;:true,&quot;enableCode&quot;:true,&quot;autoOpen&quot;:false,&quot;overwrite&quot;:true,&quot;timestamp&quot;:false,&quot;ts&quot;:false,&quot;showPassed&quot;:true,&quot;showFailed&quot;:true,&quot;showPending&quot;:true,&quot;showSkipped&quot;:false,&quot;showHooks&quot;:&quot;always&quot;,&quot;saveJson&quot;:true,&quot;saveHtml&quot;:true,&quot;dev&quot;:false,&quot;assetsDir&quot;:&quot;docs/tests/assets&quot;,&quot;jsonFile&quot;:&quot;/home/erik/Projects/@superhero/js.websocket/docs/tests/index.json&quot;,&quot;htmlFile&quot;:&quot;/home/erik/Projects/@superhero/js.websocket/docs/tests/index.html&quot;}"><div id="report"></div><script src="assets/app.js"></script></body></html>