{"_id":"hof-util-reqres","_rev":"58-ad1403a09176cc77196d374d8221c76e","name":"hof-util-reqres","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"hof-util-reqres","version":"1.0.0","author":{"name":"UKHomeOffice"},"license":"MIT","_id":"hof-util-reqres@1.0.0","maintainers":[{"name":"lennym","email":"leonard.martin@gmail.com"}],"homepage":"https://github.com/UKHomeOfficeForms/hof-util-reqres#readme","bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-util-reqres/issues"},"dist":{"shasum":"3b0141deeff8c5dc41096693f4ff6bfa79bef214","tarball":"https://registry.npmjs.org/hof-util-reqres/-/hof-util-reqres-1.0.0.tgz","integrity":"sha512-z6tHs8Th6FmDU96Tr8WMg2SM8NAkuUi6MpOGUEvl3asGsozmOy/iWMDModGzjajP6JCV2A+ceL482QoVW2tpvg==","signatures":[{"sig":"MEQCICJUp6a/g4JrXpnVGW82m05EznJPDh52BleELCD6r5pZAiBn9SFOoxBXRsxyAZUkZigYlZz2Bimwc6nebSHpDnnoqQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"3b0141deeff8c5dc41096693f4ff6bfa79bef214","gitHead":"6f42a2c393c75bd81aaa4cc8c4558974d05d5f5a","scripts":{"test":"eslint ."},"_npmUser":{"name":"lennym","email":"leonard.martin@gmail.com"},"repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-util-reqres.git","type":"git"},"_npmVersion":"4.1.2","description":"Test helper to create dummy request/response objects for testing middleware methods","directories":{},"_nodeVersion":"6.9.4","dependencies":{"reqres":"^1.2.2","hof-model":"^3.0.0"},"devDependencies":{"eslint":"^3.17.1","eslint-config-homeoffice":"^2.1.2"},"_npmOperationalInternal":{"tmp":"tmp/hof-util-reqres-1.0.0.tgz_1489421356787_0.3679342258255929","host":"packages-18-east.internal.npmjs.com"}},"1.0.1":{"name":"hof-util-reqres","version":"1.0.1","author":{"name":"UKHomeOffice"},"license":"MIT","_id":"hof-util-reqres@1.0.1","maintainers":[{"name":"lennym","email":"leonard.martin@gmail.com"},{"name":"joefitter","email":"hello@joefitter.com"},{"name":"josephchapman","email":"info@josephchapman.com"},{"name":"easternbloc","email":"ben@marvell-consulting.com"}],"homepage":"https://github.com/UKHomeOfficeForms/hof-util-reqres#readme","bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-util-reqres/issues"},"dist":{"shasum":"2586db3f268619c974b1d1383ef1cafb7ea96557","tarball":"https://registry.npmjs.org/hof-util-reqres/-/hof-util-reqres-1.0.1.tgz","integrity":"sha512-cRXsSSIFzxfnWmnugd7DZ+71PaV36hiqTUJS7vNsfcivoUCamv8A+BNnlPwd65bbVc93aZj9GHgj4KDqI5KeEQ==","signatures":[{"sig":"MEUCIQDQPv8zdLYWk521UoYrDQPPzy935Tu0pVEV0WrzIX53JQIgUKTDjIcXaFN138uBUwdINhnhVEyXWD8osyQ5TZl/SQs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","gitHead":"d8f750fcafa68c7c83a50d9e129c03fc8091c3d2","scripts":{"test":"eslint ."},"_npmUser":{"name":"lennym","email":"leonard.martin@gmail.com"},"repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-util-reqres.git","type":"git"},"_npmVersion":"5.0.2","description":"Test helper to create dummy request/response objects for testing middleware methods","directories":{},"_nodeVersion":"6.9.4","dependencies":{"reqres":"^1.2.2","hof-model":"^3.0.0"},"devDependencies":{"eslint":"^3.17.1","eslint-config-homeoffice":"^2.1.2"},"_npmOperationalInternal":{"tmp":"tmp/hof-util-reqres-1.0.1.tgz_1496675998000_0.6732274629175663","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"hof-util-reqres","version":"1.1.0","author":{"name":"UKHomeOffice"},"license":"MIT","_id":"hof-util-reqres@1.1.0","maintainers":[{"name":"lennym","email":"leonard.martin@gmail.com"},{"name":"joefitter","email":"hello@joefitter.com"},{"name":"josephchapman","email":"info@josephchapman.com"},{"name":"easternbloc","email":"ben@marvell-consulting.com"}],"homepage":"https://github.com/UKHomeOfficeForms/hof-util-reqres#readme","bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-util-reqres/issues"},"dist":{"shasum":"427dddabccfdaad43b0a701ac5db38f63cbdd851","tarball":"https://registry.npmjs.org/hof-util-reqres/-/hof-util-reqres-1.1.0.tgz","integrity":"sha512-uOfVAneKCOSM3Mx+6gKWSZL6ObROZ2dmOywq/9+nqnA/a8qbJJBOxHAqcQ+AZRFfIszBU8Uw6YqrN7d1iMxx/w==","signatures":[{"sig":"MEYCIQC8UdXeMzggltVRN91gtDAyrgZwY7K8lZzN2uadAJJolwIhANzCzlv094o/cDw+XXRjkQFuBnF0ebrPv4FYTzWYdJX2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","gitHead":"d69b11ca4c844bd3df8b19b1b11ea14af256d799","scripts":{"test":"eslint ."},"_npmUser":{"name":"lennym","email":"leonard.martin@gmail.com"},"repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-util-reqres.git","type":"git"},"_npmVersion":"5.4.2","description":"Test helper to create dummy request/response objects for testing middleware methods","directories":{},"_nodeVersion":"8.1.3","dependencies":{"reqres":"^1.2.2","hof-model":"^3.0.0"},"devDependencies":{"eslint":"^3.17.1","eslint-config-homeoffice":"^2.1.2"},"_npmOperationalInternal":{"tmp":"tmp/hof-util-reqres-1.1.0.tgz_1508513750447_0.4388447320088744","host":"s3://npm-registry-packages"}}},"time":{"created":"2017-03-13T16:09:17.422Z","modified":"2026-09-21T15:12:54.692Z","1.0.0":"2017-03-13T16:09:17.422Z","1.0.1":"2017-06-05T15:19:59.759Z","1.1.0":"2017-10-20T15:35:51.282Z"},"bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-util-reqres/issues"},"author":{"name":"UKHomeOffice"},"license":"MIT","homepage":"https://github.com/UKHomeOfficeForms/hof-util-reqres#readme","repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-util-reqres.git","type":"git"},"description":"Test helper to create dummy request/response objects for testing middleware methods","maintainers":[{"email":"aaron.russell@digital.homeoffice.gov.uk","name":"aaronrussellho"},{"email":"sas-hof-test@digital.homeoffice.gov.uk","name":"hof-bot-user"},{"email":"dk4g.blob@gmail.com","name":"dk4g"},{"email":"gregory.wolverson@digital.homeoffice.gov.uk","name":"greg_wolverson_ho"},{"email":"vinodha.samiyappan@digital.homeoffice.gov.uk","name":"vinodha.s"},{"email":"megan.john@digital.homeoffice.gov.uk","name":"meganjohn"},{"email":"nese.zorba@digital.homeoffice.gov.uk","name":"nzorba"},{"email":"rayhannur.rohman@digital.homeoffice.gov.uk","name":"rayhannurrohmanho"},{"email":"vivek.kumar1@digital.homeoffice.gov.uk","name":"vivekkumar-ho"},{"email":"leonard.martin@gmail.com","name":"lennym"}],"readme":"# hof-util-reqres\nTest helper to create dummy request/response objects for testing middleware methods\n\n## Usage\n\nIn your tests you can use the provided `req` and `res` methods to create objects with additional properties that we would expect to exist on a request that had passed through a hof request pipeline.\n\n```js\nconst request = require('hof-util-reqres').req;\nconst req = request();\n\nit('provides a sessionModel property on the request', () => {\n  expect(req.sessionModel).to.be.an.instanceOf(require('hof-model'));\n});\n\nit('provides a translate property on the request', () => {\n  expect(req.translate).to.be.a('function');\n});\n\nit('provides a form property on the request with values', () => {\n  expect(req.form).to.eql({ values: {} });\n});\n```\n\nAdditionally, the request and response objects will have all properties and methods exposed by express. Response methods will be instances of sinon stubs, and so can have assertions made against their calls.\n\nSee [reqres](https://npmjs.com/reqres) module for further details of default express behaviour.\n\n## Session Data\n\nThe session model can be pre-populated by passing a `session` option.\n\n```js\nconst request = require('hof-util-reqres').req;\nconst req = request({\n  session: { name: 'Alice' }\n});\n\nit('populates session model with `session` parameter', () => {\n  expect(req.sessionModel.get('name')).to.equal('Alice');\n});\n```\n","readmeFilename":"README.md"}