{"id":16337,"date":"2017-03-02T12:15:42","date_gmt":"2017-03-02T10:15:42","guid":{"rendered":"https:\/\/www.webcodegeeks.com\/?p=16337"},"modified":"2017-03-01T11:00:37","modified_gmt":"2017-03-01T09:00:37","slug":"test-driven-development-javascript","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/","title":{"rendered":"Test-Driven Development For JavaScript"},"content":{"rendered":"<p>JavaScript is handsdown the strangest language I\u2019ve ever had to test. Its also one of the <a href=\"http:\/\/stackoverflow.com\/research\/developer-survey-2016#technology\">most popular<\/a> ones out there right now. The influx of JavaScript developers tells us that a lot of modern-day web development is starting to focus more and more on the frontend.<\/p>\n<p>This trend is interesting because it represents a shift in development that we\u2019ve never seen before. Our applications are being composed of more and more JavaScript. However, are we effectively testing all of this newfound client-side code?<\/p>\n<p>Sort of.<\/p>\n<p>I believe that we must follow a more robust methodology to test our growing JavaScript applications. Today, I want to explore the idea of practicing Test-Driven Development (TDD) for client-side JavaScript.<\/p>\n<h2>What\u2019s So Different About Testing JavaScript?<\/h2>\n<p>In web development, we can separate our concerns into two sections: the client-side (stuff that happens in a user\u2019s web browser) and the server-side (things that happen on our application servers).<\/p>\n<p>When it comes to testing, we\u2019ve historically covered our server-side code with unit and functional tests and our client-side with integration tests. We tend to give a lot of thought and investment into server-side tests and simply verify the results with an integration test on the client-side.<\/p>\n<p>However, server-side code is and was never the complete picture of web development. What the user sees on the client-side is often what has the most impact. The most impressive technical features mean nothing if the view layer is messed up!<\/p>\n<p>Integration tests are helpful and effective when we\u2019re only concerned with what shows up on the webpage. It says nothing about what goes on inside the client-side code processing; it only shows the output of such logic.<\/p>\n<p>There was a period of time where integration tests could really serve as proper test coverage for what\u2019s going on in the client-side of our applications. However, with more and more applications having bigger shares of JavaScript, we\u2019ve got to come up with a better way of testing the client-side other than: is <em>x<\/em> showing up on the page?<\/p>\n<p>To start things off, let\u2019s look at what\u2019s familiar about TDD on the client-side. It turns out a lot of things aren\u2019t that different after all!<\/p>\n<h2>JavaScript TDD Isn\u2019t That Different<\/h2>\n<p>No matter how experienced in TDD you are, don\u2019t panic! If you\u2019ve done TDD before, applying it to client-side JavaScript isn\u2019t that different on a high level. With TDD, we want to stay true to a cycle of three steps:<\/p>\n<ol>\n<li>Write tests that reflect the expected behavior of your code.<\/li>\n<li>Write code to make those tests pass.<\/li>\n<li>(optional) Refactor and ensure the tests still pass.<\/li>\n<\/ol>\n<p>Let\u2019s run through a quick example in EmberJS.<\/p>\n<h3>A unit TDD example with EmberJS<\/h3>\n<p>Ember is really cool because it comes with a lot of great tools for testing right out of the box. If you run something as simple as: <code>ember g model user<\/code>, you\u2019ll be gifted with two important files: <code>app\/models\/user.js<\/code> and <code>tests\/unit\/user-test.js<\/code>. If you run <code>ember test<\/code>, all of your tests related to <code>user.js<\/code> should pass.<\/p>\n<p>Currently, our files look something like this:<\/p>\n<p><code>user.js<\/code><\/p>\n<pre class=\"brush:js\">import DS from 'ember-data';\r\n\r\nexport default DS.Model.extend({\r\n\r\n});<\/pre>\n<p><code>user-test.js<\/code><\/p>\n<pre class=\"brush:js\">import { moduleForModel, test } from 'ember-qunit';\r\n\r\nmoduleForModel('user', 'Unit | Model | user', {\r\n  \/\/ Specify the other units that are required for this test.\r\n  needs: []\r\n});\r\n\r\ntest('it exists', function(assert) {\r\n  let model = this.subject();\r\n  assert.ok(!!model);\r\n});<\/pre>\n<p>We want to expand our model to do two things: have a name and be able to retrieve a metric called \u201ckarma\u201d for a user. Let\u2019s write up some tests to reflect these desires:<\/p>\n<p><code>user-test.js<\/code><\/p>\n<pre class=\"brush:js\">import { moduleForModel, test } from 'ember-qunit';\r\n\r\nmoduleForModel('user', 'Unit | Model | user', {\r\n  \/\/ Specify the other units that are required for this test.\r\n});\r\n\r\ntest('it exists', function(assert) {\r\n  let model = this.subject();\r\n  assert.ok(!!model);\r\n});\r\n\r\ntest('must contain a name', function(assert) {\r\n  let model = this.subject({ name: 'testing name'});\r\n  assert.equal(model.get('name'), 'testing name');\r\n});\r\n\r\n\/\/ Note: Karma should be the combo of upvotes and downvotes against a user\r\ntest('should be able to retrieve the karma of a user', function(assert) {\r\n  let model = this.subject({ name: 'karma user', upvotes: 10, downvotes: 5});\r\n  assert.equal(model.get('karma'), 5);\r\n});<\/pre>\n<p>If we\u2019ve changed nothing to <code>user.js<\/code>, we\u2019ll find that our Ember test suite will now fail gracefully. Next up, we\u2019ll work to make these tests actually pass.<\/p>\n<p><code>user.js<\/code><\/p>\n<pre class=\"brush:js\">import Ember from 'ember';\r\nimport DS from 'ember-data';\r\n\r\nexport default DS.Model.extend({\r\n  name: DS.attr('string'),\r\n  upvotes: DS.attr('number'),\r\n  downvotes: DS.attr('number'),\r\n  karma: Ember.computed( function() {\r\n    return this.get('upvotes') - this.get('downvotes');\r\n  })\r\n});<\/pre>\n<p>Now our tests and code are good to go!<\/p>\n<p>With just a few simple steps, we were able to run through the TDD process and develop some simple but stable code! I chose not to refactor on this run through since my changes were pretty simple. However, the more complex our code becomes, the more there becomes a need for refactoring at every step.<\/p>\n<h3>Other frameworks and JavaScript code<\/h3>\n<p>Not every JavaScript framework or codebase has a built-in test runner like EmberJS (or EmberCLI) has. There still are a lot of excellent tools out there like <a href=\"https:\/\/mochajs.org\/\">Mocha<\/a> and <a href=\"https:\/\/jasmine.github.io\/\">Jasmine<\/a>. However there\u2019s <a href=\"http:\/\/stateofjs.com\/2016\/testing\/\">still a long way to go<\/a> when it comes to JavaScript test tooling.<\/p>\n<p>While client-side unit testing doesn\u2019t look that different from other kinds of testing we\u2019ve experienced, there are some noticeable differences to how we should approach it.<\/p>\n<h2>Javascript TDD Is Different<\/h2>\n<p>When implementing TDD on the client-side, we\u2019ll need to divide our testing mindset into client-side and server-side concerns.<\/p>\n<p>Client-side JavaScript cannot query a database. It can make calls for a query or query data presented on the client-side. It cannot, however, directly fetch and insert into a database. This is important because we want to assume that the data being given to the client-side (in our tests) is gospel. We should treat the server-side data being sent as an external dependency on our test.<\/p>\n<p>In many ways, we\u2019re splitting up our applications into two contained testing areas: Server-side tests are concerned with things that go on inside the server; client-side tests are concerned with stuff that happens in the web browser. In order to achieve proper test coverage of these two aspects, the amount of tests we\u2019re hauling along is going to increase. In some cases, we could have all of the following:<\/p>\n<ul>\n<li>Client-side integration tests<\/li>\n<li>Server-side functional tests<\/li>\n<li>Server-side unit tests<\/li>\n<li>Client-side unit tests<\/li>\n<li>Client-side functional tests<\/li>\n<\/ul>\n<p>Adding a lot more test weight to your application might not seem like the most attractive option. Yet, its a consequence of having complex processing on the server- and client-sides of your application. There\u2019s a lot more space to be covered, and understanding more of what\u2019s going on is essential!<\/p>\n<h2>What Does All This Mean?<\/h2>\n<p>If you\u2019re implementing TDD practices for the first time, JavaScript is a great place to start. The basics of TDD aren\u2019t too hard to get down, but it takes some practice to grasp what aspects of the domain you should test.<\/p>\n<p>If you\u2019re starting to apply previous knowledge of TDD to your frontend JavaScript, don\u2019t forget what you know. Embrace your historical knowledge and learn to understand the domain layout of the client-side.<\/p>\n<p>Ultimately, JavaScript test coverage is a hard thing to fully visualize and understand. The way we leverage the language to help us develop apps is ever changing as well. You might be adding a lot more tests to your test suite, but the understanding and coverage you\u2019ll have is worth it!<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"https:\/\/blog.codeship.com\/test-driven-development-for-javascript\/\">Test-Driven Development For JavaScript<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/join-us\/wcg\/\">WCG partner<\/a>\u00a0Taylor Jones at the <a href=\"http:\/\/blog.codeship.com\/\">Codeship Blog<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>JavaScript is handsdown the strangest language I\u2019ve ever had to test. Its also one of the most popular ones out there right now. The influx of JavaScript developers tells us that a lot of modern-day web development is starting to focus more and more on the frontend. This trend is interesting because it represents a &hellip;<\/p>\n","protected":false},"author":189,"featured_media":920,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[434,121],"class_list":["post-16337","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-tdd","tag-testing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Test-Driven Development For JavaScript - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"JavaScript is handsdown the strangest language I\u2019ve ever had to test. Its also one of the most popular ones out there right now. The influx of JavaScript\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Test-Driven Development For JavaScript - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"JavaScript is handsdown the strangest language I\u2019ve ever had to test. Its also one of the most popular ones out there right now. The influx of JavaScript\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-03-02T10:15:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Taylor Jones\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Taylor Jones\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/\"},\"author\":{\"name\":\"Taylor Jones\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/834a8ec3020fc24255939295e44ced69\"},\"headline\":\"Test-Driven Development For JavaScript\",\"datePublished\":\"2017-03-02T10:15:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/\"},\"wordCount\":1106,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"keywords\":[\"TDD\",\"Testing\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/\",\"name\":\"Test-Driven Development For JavaScript - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"datePublished\":\"2017-03-02T10:15:42+00:00\",\"description\":\"JavaScript is handsdown the strangest language I\u2019ve ever had to test. Its also one of the most popular ones out there right now. The influx of JavaScript\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Test-Driven Development For JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/834a8ec3020fc24255939295e44ced69\",\"name\":\"Taylor Jones\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/153a5fe534873be386092f34ed78df90ff7208ed8ba34a09d63a9b0abbed4717?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/153a5fe534873be386092f34ed78df90ff7208ed8ba34a09d63a9b0abbed4717?s=96&d=mm&r=g\",\"caption\":\"Taylor Jones\"},\"description\":\"Taylor Jones is a software chef at IZEA\",\"url\":\"https:\/\/www.webcodegeeks.com\/author\/taylor-jones\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Test-Driven Development For JavaScript - Web Code Geeks - 2026","description":"JavaScript is handsdown the strangest language I\u2019ve ever had to test. Its also one of the most popular ones out there right now. The influx of JavaScript","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Test-Driven Development For JavaScript - Web Code Geeks - 2026","og_description":"JavaScript is handsdown the strangest language I\u2019ve ever had to test. Its also one of the most popular ones out there right now. The influx of JavaScript","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-03-02T10:15:42+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","type":"image\/jpeg"}],"author":"Taylor Jones","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Taylor Jones","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/"},"author":{"name":"Taylor Jones","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/834a8ec3020fc24255939295e44ced69"},"headline":"Test-Driven Development For JavaScript","datePublished":"2017-03-02T10:15:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/"},"wordCount":1106,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","keywords":["TDD","Testing"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/","name":"Test-Driven Development For JavaScript - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","datePublished":"2017-03-02T10:15:42+00:00","description":"JavaScript is handsdown the strangest language I\u2019ve ever had to test. Its also one of the most popular ones out there right now. The influx of JavaScript","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/js-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/test-driven-development-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Test-Driven Development For JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/834a8ec3020fc24255939295e44ced69","name":"Taylor Jones","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/153a5fe534873be386092f34ed78df90ff7208ed8ba34a09d63a9b0abbed4717?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/153a5fe534873be386092f34ed78df90ff7208ed8ba34a09d63a9b0abbed4717?s=96&d=mm&r=g","caption":"Taylor Jones"},"description":"Taylor Jones is a software chef at IZEA","url":"https:\/\/www.webcodegeeks.com\/author\/taylor-jones\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/189"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=16337"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16337\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/920"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=16337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=16337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=16337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}