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