{"id":15538624,"url":"https://github.com/nikorablin/socket.io-stub","last_synced_at":"2026-04-11T22:01:49.145Z","repository":{"id":57365207,"uuid":"124250988","full_name":"nikorablin/socket.io-stub","owner":"nikorablin","description":"Stub for socket.io testing","archived":false,"fork":false,"pushed_at":"2018-03-07T16:23:02.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-09T12:33:55.583Z","etag":null,"topics":["nodejs","socket-io","socketio","testing"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikorablin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-07T14:52:36.000Z","updated_at":"2018-03-07T16:55:22.000Z","dependencies_parsed_at":"2022-09-15T16:03:46.142Z","dependency_job_id":null,"html_url":"https://github.com/nikorablin/socket.io-stub","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikorablin%2Fsocket.io-stub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikorablin%2Fsocket.io-stub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikorablin%2Fsocket.io-stub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikorablin%2Fsocket.io-stub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikorablin","download_url":"https://codeload.github.com/nikorablin/socket.io-stub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikorablin%2Fsocket.io-stub/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258098016,"owners_count":22650249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","socket-io","socketio","testing"],"created_at":"2024-10-02T12:05:12.713Z","updated_at":"2026-04-11T22:01:44.089Z","avatar_url":"https://github.com/nikorablin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Socket.io Stub\n\nA socket stub to use when testing [socket.io](https://socket.io/) code\n\n### Using the Stub\n\n```js\nconst manager = socket =\u003e {\n  socket.on('ping', payload =\u003e socket.emit('pong', payload));\n};\n\ndescribe('Testing socket', () =\u003e {\n  it('ping will pong', () =\u003e {\n    const socket = new SocketStub();\n    manager(socket);\n    socket.simulate('ping', true);\n    expect(socket.emitted.length).to.equal(1);\n    expect(socket.emitted).to.eql([['pong', true]]);\n  });\n});\n```\n\n### Installation\n\n```\nnpm i socket.io-stub --save-dev\n```\n\n```\nyarn add socket.io-stub --dev\n```\n\n### Tests\n\n```\nyarn test\n```\n\n### Methods\n\n**new SocketStub(properties: ?object)**\n\nInstantiate a new socket stub. You can pass a properties object into the constructor to apply properties on the Socket\n\n**simulate(event: string, payload: any)**\n\nSimulate an event on the socket\n\n**clear**\n\nClear all tracked emitted events from socket\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikorablin%2Fsocket.io-stub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikorablin%2Fsocket.io-stub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikorablin%2Fsocket.io-stub/lists"}