{"id":13475135,"url":"https://github.com/danawoodman/sinon-express-mock","last_synced_at":"2025-04-09T19:20:06.815Z","repository":{"id":57361798,"uuid":"46651214","full_name":"danawoodman/sinon-express-mock","owner":"danawoodman","description":"Simple request and response mock objects to pass into Express routes when testing using Sinon.","archived":false,"fork":false,"pushed_at":"2023-06-26T18:27:21.000Z","size":61,"stargazers_count":47,"open_issues_count":4,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T19:19:55.227Z","etag":null,"topics":["epub","helper","mock","route","router","sinon","test","testing","util","utility"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sinon-express-mock","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/danawoodman.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-22T07:43:43.000Z","updated_at":"2023-05-29T22:21:43.000Z","dependencies_parsed_at":"2024-06-18T14:04:14.279Z","dependency_job_id":null,"html_url":"https://github.com/danawoodman/sinon-express-mock","commit_stats":{"total_commits":45,"total_committers":10,"mean_commits":4.5,"dds":"0.19999999999999996","last_synced_commit":"44886d140ecf4a9a0f71e4333dbd3afb868fc578"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danawoodman%2Fsinon-express-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danawoodman%2Fsinon-express-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danawoodman%2Fsinon-express-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danawoodman%2Fsinon-express-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danawoodman","download_url":"https://codeload.github.com/danawoodman/sinon-express-mock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248094991,"owners_count":21046770,"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":["epub","helper","mock","route","router","sinon","test","testing","util","utility"],"created_at":"2024-07-31T16:01:17.635Z","updated_at":"2025-04-09T19:20:06.791Z","avatar_url":"https://github.com/danawoodman.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# sinon-express-mock\n\nSimple request and response mock objects to pass into Express routes when testing using Sinon.\n\nThe mock objects attach Sinon spys to request methods. See `src/index.js` for a full list of stubbed out methods.\n\n## Install\n\n```shell\nnpm install --save-dev sinon-express-mock sinon\n```\n\nDepends on:\n\n* Node v4+ (or `Object.assign` support needed)\n* Sinon\n\n## Usage\n\nContents of `src/foo.js`:\n\n```js\nexport default (req, res) =\u003e {\n  res.json({ foo: req.body.foo })\n}\n```\n\nContents of `test/foo-test.js`:\n\n```js\nimport route from '../src/foo'\nimport chai, { expect } from 'chai'\nimport sinonChai from 'sinon-chai'\nimport { mockReq, mockRes } from 'sinon-express-mock'\n\nchai.use(sinonChai);\n\ndescribe('my route', () =\u003e {\n  it('should foo the bar', () =\u003e {\n    const request = {\n      body: {\n        foo: 'bar',\n      },\n    }\n    const req = mockReq(request)\n    const res = mockRes()\n\n    route(req, res)\n\n    expect(res.json).to.be.calledWith({ foo: request.body.foo })\n  })\n})\n```\n\n## Changelog\n\n### v2.0.3\n\n* `res.write()` is now stubbed.\n\n### v2.0.0\n\n* Make sinon a `peerDependency`.\n\n### v1.3.1\n\n* Bundle fix from #3\n\n### pre v1.3.1\n\n* Changelog didn't exist! 😱\n\n## Credits\n\nDana Woodman and [contributors](https://github.com/danawoodman/sinon-express-mock/graphs/contributors)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanawoodman%2Fsinon-express-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanawoodman%2Fsinon-express-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanawoodman%2Fsinon-express-mock/lists"}