{"id":13415,"date":"2019-03-25T09:00:35","date_gmt":"2019-03-25T00:00:35","guid":{"rendered":"https:\/\/www.agent-grow.com\/self20percent\/?p=13415"},"modified":"2019-03-20T11:04:55","modified_gmt":"2019-03-20T02:04:55","slug":"only-express-and-jest-testing","status":"publish","type":"post","link":"https:\/\/www.agent-grow.com\/self20percent\/2019\/03\/25\/only-express-and-jest-testing\/","title":{"rendered":"express \u3068 jest \u3060\u3051\u3067\u30b5\u30c3\u30af\u30ea\u3068\u30c6\u30b9\u30c8\u3092\u66f8\u304f\uff01(superagent \u3068\u304b\u4f7f\u308f\u306a\u3044)"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u6c5f\u5d5c\u3067\u3059\u3002<\/p>\n<p>\u307f\u306a\u3055\u3093\u3001\u30c6\u30b9\u30c8\u66f8\u3044\u3066\u307e\u3059\u304b\uff1f<\/p>\n<p>\u3076\u3063\u3061\u3083\u3051\u79c1\u306f\u30c6\u30b9\u30c8\u66f8\u304f\u306e\u3042\u3093\u307e\u308a\u597d\u304d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u306a\u3093\u3068\u3044\u3046\u304b\u3001\u4f5c\u696d\u611f\u3042\u308b\u3093\u3067\u3059\u3088\u306d\u3002\u30c6\u30b9\u30c8\u3063\u3066\u3002<\/p>\n<p>\u307e\u3041\u3001\u305d\u3093\u306a\u3053\u3068\u8a00\u3063\u3066\u3082\u3001\u5b9f\u969b\u30c6\u30b9\u30c8\u306f\u5fc5\u8981\u3067\u3059\u3057\u3001<br \/>\n\u4f55\u5ea6\u3082\u30c6\u30b9\u30c8\u306b\u52a9\u3051\u3089\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u66f8\u304f\u3093\u3067\u3059\u3051\u3069\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001express \u3067\u4f5c\u3063\u3066\u3044\u308b API \u306b\u5bfe\u3057\u3066\u3001\u3069\u3046\u3084\u3063\u305f\u3089\u7c21\u5358\u306b\u30c6\u30b9\u30c8\u3092\u304b\u3051\u308b\u304b\u306a\u3068\u601d\u3063\u3066\u8003\u3048\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u5927\u4f53\u3053\u3046\u3044\u3046\u306e\u8abf\u3079\u308b\u3068\u3001\u5b9f\u969b\u306b express \u52d5\u304b\u3057\u3066 superagent \u3067\u30ea\u30af\u30a8\u30b9\u30c8\u6d41\u3057\u3066\u2026<br \/>\n\u307f\u305f\u3044\u306a\u3053\u3068\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u308c\u306f\u9762\u5012\u306a\u306e\u3067\u3001\u4eca\u56de\u306f superagent \u306a\u3057\u3067\u3084\u3063\u3066\u307f\u3088\u3046\u304b\u3068\u3002<\/p>\n<h1>\u3068\u308a\u3042\u3048\u305a\u30c6\u30b9\u30c8\u3055\u308c\u308b\u74b0\u5883\u6e96\u5099<\/h1>\n<p>\u4eca\u56de\u306f express \u3068 jest \u3092\u4f7f\u3046\u306e\u3067\u3001\u3053\u306e\u4e8c\u3064\u3092\u6e96\u5099\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b jest \u306f<\/p>\n<blockquote><p>\n  Jest is a delightful JavaScript Testing Framework with a focus on simplicity.\n<\/p><\/blockquote>\n<p>\u3068<a href=\"https:\/\/jestjs.io\/ja\/\" rel=\"noopener noreferrer\" target=\"_blank\">\u516c\u5f0f\u30da\u30fc\u30b8<\/a>\u306b\u3082\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u304c\u3001<br \/>\n\u3068\u3066\u3082\u7c21\u5358\u306b\u30c6\u30b9\u30c8\u304c\u66f8\u3051\u308b\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nnpm install --save express\nnpm install --save-dev express\n<\/pre>\n<p>\u30b5\u30fc\u30d0\u30fc\u306e\u30b3\u30fc\u30c9\u306f\u3068\u308a\u3042\u3048\u305a\u7c21\u5358\u306b\u3053\u3093\u306a\u611f\u3058\u3067\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst express = require(\u2019express\u2019)\nconst app = express()\nconst router = express.Router()\n\nrouter.get(\u2019\/\u2019, (req, res) =\uff1e {\n  if (req.query.id) {\n    return res.status(200).send(`Hi! ${req.query.id}`)\n  }\n\n  res.status(400).send(\u2019Who are you?\u2019)\n})\n\napp.use(\u2019\/\u2019, router)\n\napp.listen(3000)\n<\/pre>\n<p>\u30b5\u30fc\u30d0\u30fc\u3092 <code>node index.js<\/code> \u3067\u8d77\u52d5\u3057\u3066\u3001 <a href=\"https:\/\/www.getpostman.com\/\" rel=\"noopener noreferrer\" target=\"_blank\">Postman<\/a> \u3067\u30ea\u30af\u30a8\u30b9\u30c8\u53e9\u3044\u3066\u307f\u308b\u3068\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"13418\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/03\/25\/only-express-and-jest-testing\/%e7%84%a1%e9%a1%8c-56\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-5.png\" data-orig-size=\"800,531\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\u7121\u984c\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-5-300x199.png\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-5.png\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-5.png\" alt=\"\" width=\"800\" height=\"531\" class=\"alignnone size-full wp-image-13418\" srcset=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-5.png 800w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-5-300x199.png 300w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-5-768x510.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>\u304d\u3061\u3093\u3068 id \u306b\u8a2d\u5b9a\u3057\u305f\u540d\u524d\u3067\u8fd4\u7b54\u3057\u3066\u304f\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u554f\u984c\u306a\u3055\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n<h1>jest \u3067\u30c6\u30b9\u30c8\u3092\u66f8\u304f<\/h1>\n<p>\u3067\u306f\u3001\u3053\u306e\u30b5\u30fc\u30d0\u30fc\u306b\u5bfe\u3057\u3066\u30c6\u30b9\u30c8\u3092\u66f8\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u3053\u3067\u6700\u7d42\u7684\u306b\u30c6\u30b9\u30c8\u3057\u305f\u3044\u306e\u306f\u3001\u4e00\u8a00\u3067\u8a00\u3048\u3070<br \/>\n\u300c <code>\/<\/code> (\u30eb\u30fc\u30c8) \u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3068\u304d\u306b\u3001 id \u304c\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u540d\u524d\u3092\u542b\u3080\u6587\u5b57\u5217\u3092\u8fd4\u3059\u300d<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3057\u3087\u3046\u304c\u3001\u3053\u308c\u306f\u3044\u308f\u3086\u308b\u7d50\u5408\u30c6\u30b9\u30c8\u3067\u3059\u306d\u3002<br \/>\n\u3053\u306e\u5834\u5408\u306f\u5b9f\u969b\u306b\u8d77\u52d5\u3057\u305f\u30b5\u30fc\u30d0\u30fc\u306b\u5bfe\u3057\u3066 superagent \u306a\u3069\u3067\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u3057\u304b\u306a\u3044\u3067\u3059\u304c\u3001<br \/>\n\u57fa\u672c\u306f\u3082\u3063\u3068\u7d30\u304b\u3044\u7c92\u5ea6\u3067\u3084\u308a\u305f\u3044\u3068\u3053\u308d\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306f\u5916\u3057\u3066\u3001<br \/>\n\u30a2\u30af\u30bb\u30b9\u3055\u308c\u305f\u3068\u304d\u306e\u6319\u52d5 (\u300cid \u304c\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u540d\u524d\u3092\u542b\u3080\u6587\u5b57\u5217\u3092\u8fd4\u3059\u300d \u306e\u90e8\u5206) \u3060\u3051\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3068\u51e6\u7406\u3092\u5207\u308a\u96e2\u3059<\/h2>\n<p>\u307e\u305a\u306f\u6700\u521d\u306b\u3001\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u90e8\u5206\u3068\u3001\u5b9f\u969b\u306e\u51e6\u7406\u3092\u5207\u308a\u96e2\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>JavaScript \u306a\u3089\u7c21\u5358\u306b\u5225\u30d5\u30a1\u30a4\u30eb\u306b\u5207\u308a\u51fa\u305b\u307e\u3059\u306d\u3002<\/p>\n<p>index.js<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst express = require(\u2019express\u2019)\nconst app = express()\nconst router = express.Router()\nconst { Get } = require(\u2019.\/root\u2019)\n\nrouter.get(\u2019\/\u2019, Get)\n\napp.use(\u2019\/\u2019, router)\n\napp.listen(3000)\n<\/pre>\n<p>root.js<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nexports.Get = (req, res) =\uff1e {\n  if (req.query.id) {\n    return res.status(200).send(`Hi! ${req.query.id}`)\n  }\n\n  res.status(400).send(\u2019Who are you?\u2019)\n}\n<\/pre>\n<p>\u51e6\u7406\u306e\u65b9\u3092\u3001root \u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306a\u306e\u3067 <code>root.js<\/code> \u3068\u3057\u3066\u5207\u308a\u51fa\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001 <code>root.js<\/code> \u306e <code>Get<\/code> \u306b\u5bfe\u3057\u3066\u30c6\u30b9\u30c8\u3092\u66f8\u304f\u3053\u3068\u3067<br \/>\n\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u90e8\u5206\u3092\u7121\u8996\u3057\u3066\u30c6\u30b9\u30c8\u304c\u3067\u304d\u307e\u3059\u306d\u3002<\/p>\n<p>\u672c\u5f53\u306f\u3082\u3046\u4e00\u3064\u7406\u7531\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u305d\u308c\u306f\u5f8c\u307b\u3069\u3002<\/p>\n<h2>\u30c6\u30b9\u30c8\u3092\u66f8\u304f<\/h2>\n<p>\u3067\u306f\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4eca\u56de\u306f\u6700\u521d\u306b\u304a\u8a71\u3057\u305f\u901a\u308a\u3001 jest \u3092\u4f7f\u3063\u3066\u3044\u304d\u307e\u3059\u3088\u3002<br \/>\n<code>__test__<\/code> \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3066\u3001\u305d\u306e\u4e2d\u306b\u30c6\u30b9\u30c8\u3092\u683c\u7d0d\u3057\u307e\u3059\u3002<\/p>\n<p>root.test.js<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst { Get } = require(\u2019..\/root\u2019)\n\ntest(\u2019status 200 with id\u2019, () =\uff1e {\n  \/\/ \u3053\u3053\u306b\u30c6\u30b9\u30c8\u3092\u66f8\u304f\n})\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u306d\u3002<\/p>\n<p>\u3055\u3066\u3001\u3053\u3053\u3067\u3069\u306e\u3088\u3046\u306b\u30c6\u30b9\u30c8\u3092\u66f8\u304f\u304b\u3001\u3068\u3044\u3046\u4e8b\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3068\u308a\u3042\u3048\u305a id \u304c\u683c\u7d0d\u3055\u308c\u3066\u308c\u3070 200 \u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u304c\u683c\u7d0d\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f\u3044\u3067\u3059\u306d\u3002<br \/>\n\u4eca\u56de\u306f\u30b5\u30fc\u30d0\u30fc\u3092\u5b9f\u969b\u306b\u7acb\u3066\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u306e\u3067\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u3057\u3066<br \/>\n\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u3053\u3067\u3001\u5143\u306e root.js \u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068\u3001<br \/>\n\u5f15\u6570\u304b\u3089\u6e21\u3055\u308c\u305f res \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e <code>status()<\/code> \u306b\u6e21\u3055\u308c\u305f\u5024\u304c\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u3067\u3059\u306d\u3002<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3053\u308c\u3092\u78ba\u8a8d\u3057\u3066\u3001 200 \u304c\u5f15\u6570\u3068\u3057\u3066\u6e21\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3067\u304d\u308c\u3070\u3088\u3044\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u3055\u3066\u3001\u3053\u3053\u3067\u5148\u307b\u3069\u3001\u51e6\u7406\u3092\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u304b\u3089\u5206\u3051\u305f\u3082\u3046\u4e00\u3064\u306e\u5229\u70b9\u304c\u767a\u63ee\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u51e6\u7406\u3092\u5206\u3051\u305f\u3053\u3068\u3067\u3001\u4eca\u56de\u30c6\u30b9\u30c8\u3059\u308b\u90e8\u5206\u306f\u5358\u7d14\u306a\u95a2\u6570\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306d\uff01<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001 req, res \u306b\u5f53\u305f\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30e2\u30c3\u30af\u3092\u4f5c\u3063\u3066\u3001<br \/>\n\u5358\u7d14\u306b\u95a2\u6570\u306b\u6e21\u3059\u3060\u3051\u3067\u30c6\u30b9\u30c8\u304c\u51fa\u6765\u308b\uff01\u3068\u3044\u3046\u5bf8\u6cd5\u3067\u3059\u306d\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001 jest \u306b\u306f\u5f37\u529b\u306a\u30e2\u30c3\u30af\u4f5c\u6210\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001<br \/>\n\u3053\u308c\u3092\u4f7f\u3048\u3070\u2026<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst { Get } = require(\u2019..\/root\u2019)\n\ntest(\u2019status 200 with id\u2019, () =\uff1e {\n  const req = {\n    query: {\n      id: \u2019ezaki\u2019\n    }\n  }\n\n  const res = {\n    status: jest.fn().mockReturnThis(),\n    send: jest.fn().mockReturnThis()\n  }\n\n  Get(req, res)\n\n  expect(res.status.mock.calls&#x5B;0]&#x5B;0]).toBe(200)\n})\n<\/pre>\n<p>request \u306e\u65b9\u306f\u3001\u5358\u7d14\u306b query \u306b\u683c\u7d0d\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53c2\u7167\u3057\u3066\u3044\u308b\u3060\u3051\u306a\u306e\u3067\u3001\u30ab\u30f3\u30bf\u30f3\u3067\u3059\u306d\u3002<br \/>\nresponse \u306e\u65b9\u306f <code>jest.fn()<\/code> \u3092\u4f7f\u3063\u3066\u30e2\u30c3\u30af\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n<code>mockReturnThis()<\/code> \u3092\u6307\u5b9a\u3057\u3066\u304a\u3051\u3070\u3001 this \u3092\u8fd4\u5374\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3001<br \/>\nexpress \u306e\u3088\u3046\u306b <code>res.status().send()<\/code> \u3068\u3044\u3063\u305f\u611f\u3058\u3067\u30c1\u30a7\u30fc\u30f3\u30e1\u30bd\u30c3\u30c9\u3067<br \/>\n\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u3053\u3068\u306b\u3082\u7c21\u5358\u306b\u5bfe\u5fdc\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3067\u3001\u5b9f\u969b\u306e\u30c6\u30b9\u30c8\u306f<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nexpect(res.status.mock.calls&#x5B;0]&#x5B;0]).toBe(200)\n<\/pre>\n<p>\u3053\u3053\u3067\u3059\u306d\u3002<\/p>\n<p>\u8a73\u3057\u3044\u8aac\u660e\u306f<a href=\"https:\/\/jestjs.io\/docs\/ja\/mock-functions\" rel=\"noopener noreferrer\" target=\"_blank\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3092\u53c2\u7167\u3057\u3066\u3082\u3089\u3046\u3068\u3057\u3066\u3001<br \/>\n\u30ab\u30f3\u30bf\u30f3\u306b\u8a71\u3059\u3068\u3001\u547c\u3073\u51fa\u3055\u308c\u305f\u30e2\u30c3\u30af\u306b\u5bfe\u3057\u3066 <code>mock.calls[n][m]<\/code>  \u3067\u3001<\/p>\n<ul>\n<li>n \u756a\u76ee\u306e\u5f15\u6570\u306b\u5bfe\u3057\u3066<\/li>\n<li>m \u56de\u76ee\u306e\u547c\u3073\u51fa\u3057\u3067<\/li>\n<\/ul>\n<p>\u6307\u5b9a\u3055\u308c\u305f\u5f15\u6570\u3092\u53d6\u308a\u51fa\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u5f15\u6570 1 \u3064\u3001\u547c\u3073\u51fa\u3057\u305f\u56de\u6570\u3082 1 \u56de\u306a\u306e\u3067\u3001 <code>mock.calls[0][0]<\/code> \u306b<br \/>\n\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u3068\u3057\u3066\u6307\u5b9a\u3057\u305f 200 \u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u306d\u3002<\/p>\n<p>\u3068\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u30c6\u30b9\u30c8\u3092\u66f8\u3044\u3066\u3001 package.json \u306e scripts \u306b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\u201dtest\u201d: \u201djest\u201d\n<\/pre>\n<p>\u3068\u3057\u3066\u3001 <code>npm test<\/code> \u3092\u5b9f\u884c\u3059\u308b\u3068\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"13422\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/03\/25\/only-express-and-jest-testing\/%e7%84%a1%e9%a1%8c-1-7\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/2dbba63b65be5b241a1087c427d95864-1.png\" data-orig-size=\"275,155\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\u7121\u984c (1)\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/2dbba63b65be5b241a1087c427d95864-1.png\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/2dbba63b65be5b241a1087c427d95864-1.png\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/2dbba63b65be5b241a1087c427d95864-1.png\" alt=\"\" width=\"275\" height=\"155\" class=\"alignnone size-full wp-image-13422\" \/><\/p>\n<p>\u30d0\u30c3\u30c1\u30ea\u3067\u3059\u306d\uff01<\/p>\n<p>\u3061\u306a\u307f\u306b request \u306e id \u3092\u7a7a\u306b\u3057\u3066\u307f\u308b\u3068\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"13423\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/03\/25\/only-express-and-jest-testing\/%e7%84%a1%e9%a1%8c2\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/76c691c22c7ef40a64aa64b04f05e90c.png\" data-orig-size=\"354,358\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\u7121\u984c2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/76c691c22c7ef40a64aa64b04f05e90c-297x300.png\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/76c691c22c7ef40a64aa64b04f05e90c.png\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/76c691c22c7ef40a64aa64b04f05e90c.png\" alt=\"\" width=\"354\" height=\"358\" class=\"alignnone size-full wp-image-13423\" srcset=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/76c691c22c7ef40a64aa64b04f05e90c.png 354w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/76c691c22c7ef40a64aa64b04f05e90c-297x300.png 297w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/76c691c22c7ef40a64aa64b04f05e90c-60x60.png 60w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/76c691c22c7ef40a64aa64b04f05e90c-120x120.png 120w\" sizes=\"auto, (max-width: 354px) 100vw, 354px\" \/><\/p>\n<p>\u304d\u3061\u3093\u3068\u30c6\u30b9\u30c8\u5931\u6557\u3057\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<h1>JavaScript \u3067\u3082\u30b5\u30af\u30b5\u30af\u30c6\u30b9\u30c8\u304b\u3053\u3046\uff01<\/h1>\n<p>\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\nexpress \u306e\u30b5\u30fc\u30d0\u30fc\u8d77\u52d5\u3057\u3066\u2026\u3068\u304b\u3063\u3066\u30c6\u30b9\u30c8\u3059\u308b\u3068\u5927\u5909\u3067\u3059\u304c\u3001<br \/>\n\u5207\u308a\u5206\u3051\u308c\u3070\u7d50\u69cb\u7c21\u5358\u306b\u30c6\u30b9\u30c8\u304b\u3051\u308b\u3093\u3060\u306a\u30fc\u3063\u3066\u611f\u3058\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u3053\u306e\u7c21\u5358\u3055\u306f jest \u306e\u30e2\u30c3\u30af\u6a5f\u80fd\u306b\u3088\u308b\u3068\u3053\u308d\u304c\u5927\u304d\u3044\u306e\u3067\u3001<br \/>\njest \u306e\u4fbf\u5229\u3055\u3082\u5206\u304b\u3063\u3066\u3082\u3089\u3048\u305f\u3093\u3058\u3083\u306a\u3044\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u307f\u306a\u3055\u3093\uff01<br \/>\nJavaScript \u3067\u3082\u697d\u3057\u3044\u30c6\u30b9\u30c8\u751f\u6d3b\u3057\u307e\u3057\u3087\u3046\u306d\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u6c5f\u5d5c\u3067\u3059\u3002 \u307f\u306a\u3055\u3093\u3001\u30c6\u30b9\u30c8\u66f8\u3044\u3066\u307e\u3059\u304b\uff1f \u3076\u3063\u3061\u3083\u3051\u79c1\u306f\u30c6\u30b9\u30c8\u66f8\u304f\u306e\u3042\u3093\u307e\u308a\u597d\u304d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 \u306a\u3093\u3068\u3044\u3046\u304b\u3001\u4f5c\u696d\u611f\u3042\u308b\u3093\u3067\u3059\u3088\u306d\u3002\u30c6\u30b9\u30c8\u3063\u3066\u3002 \u307e\u3041\u3001\u305d\u3093\u306a\u3053\u3068\u8a00\u3063\u3066\u3082\u3001\u5b9f\u969b\u30c6\u30b9\u30c8\u306f\u5fc5\u8981\u3067\u3059\u3057\u3001 \u4f55\u5ea6\u3082 [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":13425,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[495,45,496,494],"class_list":["post-13415","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-express","tag-javascript","tag-jest","tag-test"],"jetpack_featured_media_url":"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/850c7612116999490846136e772ab7fd-1.png","jetpack_shortlink":"https:\/\/wp.me\/p7Bq4F-3un","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/13415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/comments?post=13415"}],"version-history":[{"count":0,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/13415\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media\/13425"}],"wp:attachment":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media?parent=13415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/categories?post=13415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/tags?post=13415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}