{"componentChunkName":"component---src-components-posts-page-layout-js","path":"/blog/intro-to-javascript-testing/","result":{"data":{"mdx":{"id":"9f5309fb-db3d-5bc2-b01f-b7fdfbf48fce","body":"var _excluded = [\"components\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\nvar _frontmatter = {\n  \"title\": \"Introduction to JavaScript Testing\",\n  \"date\": \"2020-09-23\",\n  \"status\": \"👩‍🌾\",\n  \"tags\": [\"JavaScript\", \"Testing\"]\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Writing tests for my new job has been a big struggle for me recently. It feels like when I first got started programming, I knew what I wanted to do but I couldn't tell the computer how to get it done. My work uses Jest and Enzyme, but for my side project PlayItForward I'll be using \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://jestjs.io/docs/en/getting-started.html\"\n  }, \"Jest\"), \" and \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://testing-library.com/docs/react-testing-library/intro\"\n  }, \"React Testing Library\"), \". Luckily Kent C. Dodds has a great course to learn all about \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://testingjavascript.com/\"\n  }, \"Testing JavaScript\"), \". Here you'll find my notes and thoughts on the course:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"The most fundamental form of a test is determining if the result is equal to the expected value, if it doesn't match the test should throw an error\")), mdx(\"p\", null, \"ESLint can be used for static testing to help give you confidence in your application without having to set up a bunch of tests.\\nTypeScript can give you a bit of static testing as well to help with type checking and small typos\"), mdx(\"p\", null, \"After mocking you need to clean up to ensure you don't affect the next test that may not want to mock or wants to mock in a different way\"));\n}\n;\nMDXContent.isMDXComponent = true;","slug":"intro-to-javascript-testing","excerpt":"Writing tests for my new job has been a big struggle for me recently. It feels like when I first got started programming, I knew what I…","frontmatter":{"title":"Introduction to JavaScript Testing","tags":["JavaScript","Testing"]}}},"pageContext":{"id":"9f5309fb-db3d-5bc2-b01f-b7fdfbf48fce"}},"staticQueryHashes":["3364050859"]}