{"id":21744,"date":"2015-07-08T13:29:02","date_gmt":"2015-07-08T07:59:02","guid":{"rendered":"https:\/\/2thenew.today\/blog\/?p=21744"},"modified":"2015-07-09T19:09:26","modified_gmt":"2015-07-09T13:39:26","slug":"make-custom-matcher-for-testing-with-jasmine","status":"publish","type":"post","link":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/","title":{"rendered":"Custom matcher for testing with Jasmine"},"content":{"rendered":"<p><strong>Jasmine<\/strong> is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code.<\/p>\n<p>Jasmine provides a wide list of built-in matchers:<\/p>\n<p>Arrays:<br \/>\n\t[javascript]<br \/>\n\t\texpect(array).toBeArray();<br \/>\n\t\texpect(array).toBeArrayOfNumbers();<br \/>\n\t\texpect(array).toBeEmptyArray();[\/javascript]<\/p>\n<p>Booleans:<br \/>\n\t[javascript]<br \/>\n\t\texpect(boolean).toBeBoolean();<br \/>\n\t  \texpect(boolean).toBeFalse();<br \/>\n\t  \texpect(boolean).toBeTrue();[\/javascript]<\/p>\n<p>Mix:<br \/>\n\t[javascript]<br \/>\n\t\texpect(instance).toBe(instance);<br \/>\n\t\texpect(number).toBeGreaterThan(number);<br \/>\n\t\texpect(number).toBeLessThan(number);<br \/>\n\t\texpect(mixed).toBeNull();<br \/>\n\t\texpect(mixed).toBeUndefined();[\/javascript]<\/p>\n<p>We can use these matchers in our test cases like this:<\/p>\n<p>\t[javascript]<br \/>\n\tit(&#8216;Test case description&#8217;, function() {<br \/>\n\t\tvar status = true;<br \/>\n  \t\texpect(status).toBeTrue();   \/\/ This will pass<br \/>\n\t\texpect(status).toBeFalse();   \/\/ this will fail<br \/>\n\t});<br \/>\n[\/javascript]<\/p>\n<p>Not only that, we can also create our own custom matcher and publish it in the community so that other users can also use it. We can write simple functions that will work as matchers.<br \/>\nLet&#8217;s see, how we can do this:<\/p>\n<p>[javascript]<br \/>\ndescribe(&#8216;custom matchers demo&#8217;, function() {<br \/>\n  beforeEach(function() {<br \/>\n    \/\/ register these matchers before each test cases. Once a custom matcher is registered with Jasmine, it is available on any test case.<br \/>\n    jasmine.addMatchers({<br \/>\n      toBeValidAge: function() {<br \/>\n        return {<br \/>\n          compare: function(actual, expected) {<br \/>\n\t\t\t\/\/compare function that takes an actual value and expected value.<br \/>\n  \t\t\t\/\/ expect(10).matcher(20);   actual will be 10 and expected will be 20.<br \/>\n            var result = {};<br \/>\n            result.pass = (actual &amp;gt;=18 &amp;amp;&amp;amp; actual &amp;lt;=35);<br \/>\n\t\t\t\/\/ Our custom logic goes here.<br \/>\n            result.message = actual + &#8216; is not valid age for this job&#8217;;<br \/>\n\t\t\t\/\/ This will be shown when test get failed<br \/>\n            return result;<br \/>\n\t\t\t\/\/The compare function must return a result object with:<br \/>\n\t\t\t\/\/ 1. A &#8216;pass&#8217; property that is a boolean result of the matcher<br \/>\n\t\t\t\/\/ 2. A &#8216;message&#8217; property that is a string to show details when test get failed.<br \/>\n          }<br \/>\n        };<br \/>\n      }<br \/>\n    });<br \/>\n  });<\/p>\n<p>\/\/ First test<br \/>\n  it(&#8216;age should be valid for this job&#8217;, function() {<br \/>\n    var myAge = 23;<br \/>\n    expect(myAge).toBeValidAge();<br \/>\n\t\/\/ return true if test will pass<br \/>\n  });<\/p>\n<p>\/\/ Second test<br \/>\n  it(&#8216;age should be valid for this job&#8217;, function() {<br \/>\n    var yourAge = 15;<br \/>\n    expect(yourAge).toBeValidAge();<br \/>\n\t\/\/ return false if test will fail<br \/>\n  });<br \/>\n});[\/javascript]<\/p>\n<p>In line 13 we have customized our error messages to display the following message: <strong>&#8216;age&#8217; is not valid age for this job<\/strong>.<\/p>\n<p>This happens because the second test fails as the passed age &#8217;15&#8217; is not between &#8217;18&#8217; and &#8217;35&#8217; in the above example.  <\/p>\n<p>Happy Testing \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jasmine is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code. Jasmine provides a wide list of built-in matchers: Arrays: [javascript] expect(array).toBeArray(); expect(array).toBeArrayOfNumbers(); expect(array).toBeEmptyArray();[\/javascript] Booleans: [javascript] expect(boolean).toBeBoolean(); expect(boolean).toBeFalse(); [&hellip;]<\/p>\n","protected":false},"author":149,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":14,"footnotes":""},"categories":[1185,1,1816],"tags":[1969,14,1158,55,1968,1124,1159],"class_list":["post-21744","post","type-post","status-publish","format-standard","hentry","category-node-js-2","category-technology","category-testing-2","tag-custom-matcher","tag-testing","tag-jasmine","tag-javascript","tag-matcher","tag-node-js","tag-unit-testing"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Jasmine is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code. Jasmine provides a wide list of built-in matchers: Arrays: [javascript] expect(array).toBeArray(); expect(array).toBeArrayOfNumbers(); expect(array).toBeEmptyArray();[\/javascript] Booleans: [javascript] expect(boolean).toBeBoolean(); expect(boolean).toBeFalse();\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Mohit Tyagi\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Custom matcher for testing with Jasmine | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Jasmine is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code. Jasmine provides a wide list of built-in matchers: Arrays: [javascript] expect(array).toBeArray(); expect(array).toBeArrayOfNumbers(); expect(array).toBeEmptyArray();[\/javascript] Booleans: [javascript] expect(boolean).toBeBoolean(); expect(boolean).toBeFalse();\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"article:tag\" content=\"node.js\" \/>\n\t\t<meta property=\"article:tag\" content=\"technology\" \/>\n\t\t<meta property=\"article:tag\" content=\"testing\" \/>\n\t\t<meta property=\"article:tag\" content=\"custom matcher\" \/>\n\t\t<meta property=\"article:tag\" content=\"functional testing\" \/>\n\t\t<meta property=\"article:tag\" content=\"jasmine\" \/>\n\t\t<meta property=\"article:tag\" content=\"javascript\" \/>\n\t\t<meta property=\"article:tag\" content=\"matcher\" \/>\n\t\t<meta property=\"article:tag\" content=\"unit testing\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2015-07-08T07:59:02+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2015-07-09T13:39:26+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Custom matcher for testing with Jasmine | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Jasmine is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code. Jasmine provides a wide list of built-in matchers: Arrays: [javascript] expect(array).toBeArray(); expect(array).toBeArrayOfNumbers(); expect(array).toBeEmptyArray();[\/javascript] Booleans: [javascript] expect(boolean).toBeBoolean(); expect(boolean).toBeFalse();\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/#article\",\"name\":\"Custom matcher for testing with Jasmine | TO THE NEW Blog\",\"headline\":\"Custom matcher for testing with Jasmine\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit-tyagi\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2015-07-08T13:29:02+05:30\",\"dateModified\":\"2015-07-09T19:09:26+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/#webpage\"},\"articleSection\":\"Node.js, Technology, Testing, custom matcher, Functional Testing, jasmine, javascript, matcher, node.js, unit testing\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/#listItem\",\"name\":\"Custom matcher for testing with Jasmine\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/#listItem\",\"position\":3,\"name\":\"Custom matcher for testing with Jasmine\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit-tyagi\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit-tyagi\\\/\",\"name\":\"Mohit Tyagi\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fe8ac46f2ea97ddfd745b7dec1382497956728370a80f84c149bf22d9da6f19f?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Mohit Tyagi\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/\",\"name\":\"Custom matcher for testing with Jasmine | TO THE NEW Blog\",\"description\":\"Jasmine is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code. Jasmine provides a wide list of built-in matchers: Arrays: [javascript] expect(array).toBeArray(); expect(array).toBeArrayOfNumbers(); expect(array).toBeEmptyArray();[\\\/javascript] Booleans: [javascript] expect(boolean).toBeBoolean(); expect(boolean).toBeFalse();\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/make-custom-matcher-for-testing-with-jasmine\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit-tyagi\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/mohit-tyagi\\\/#author\"},\"datePublished\":\"2015-07-08T13:29:02+05:30\",\"dateModified\":\"2015-07-09T19:09:26+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Custom matcher for testing with Jasmine | TO THE NEW Blog","description":"Jasmine is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code. Jasmine provides a wide list of built-in matchers: Arrays: [javascript] expect(array).toBeArray(); expect(array).toBeArrayOfNumbers(); expect(array).toBeEmptyArray();[\/javascript] Booleans: [javascript] expect(boolean).toBeBoolean(); expect(boolean).toBeFalse();","canonical_url":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/#article","name":"Custom matcher for testing with Jasmine | TO THE NEW Blog","headline":"Custom matcher for testing with Jasmine","author":{"@id":"https:\/\/2thenew.today\/blog\/author\/mohit-tyagi\/#author"},"publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"},"datePublished":"2015-07-08T13:29:02+05:30","dateModified":"2015-07-09T19:09:26+05:30","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/#webpage"},"articleSection":"Node.js, Technology, Testing, custom matcher, Functional Testing, jasmine, javascript, matcher, node.js, unit testing"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.today\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/2thenew.today\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/#listItem","name":"Custom matcher for testing with Jasmine"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/#listItem","position":3,"name":"Custom matcher for testing with Jasmine","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.today\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.today\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.today\/blog\/author\/mohit-tyagi\/#author","url":"https:\/\/2thenew.today\/blog\/author\/mohit-tyagi\/","name":"Mohit Tyagi","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/fe8ac46f2ea97ddfd745b7dec1382497956728370a80f84c149bf22d9da6f19f?s=96&d=mm&r=g","width":96,"height":96,"caption":"Mohit Tyagi"}},{"@type":"WebPage","@id":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/#webpage","url":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/","name":"Custom matcher for testing with Jasmine | TO THE NEW Blog","description":"Jasmine is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code. Jasmine provides a wide list of built-in matchers: Arrays: [javascript] expect(array).toBeArray(); expect(array).toBeArrayOfNumbers(); expect(array).toBeEmptyArray();[\/javascript] Booleans: [javascript] expect(boolean).toBeBoolean(); expect(boolean).toBeFalse();","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.today\/blog\/author\/mohit-tyagi\/#author"},"creator":{"@id":"https:\/\/2thenew.today\/blog\/author\/mohit-tyagi\/#author"},"datePublished":"2015-07-08T13:29:02+05:30","dateModified":"2015-07-09T19:09:26+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.today\/blog\/#website","url":"https:\/\/2thenew.today\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"article","og:title":"Custom matcher for testing with Jasmine | TO THE NEW Blog","og:description":"Jasmine is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code. Jasmine provides a wide list of built-in matchers: Arrays: [javascript] expect(array).toBeArray(); expect(array).toBeArrayOfNumbers(); expect(array).toBeEmptyArray();[\/javascript] Booleans: [javascript] expect(boolean).toBeBoolean(); expect(boolean).toBeFalse();","og:url":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/","og:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","article:tag":{"0":"node.js","1":"technology","2":"testing","3":"custom matcher","4":"functional testing","5":"jasmine","6":"javascript","7":"matcher","9":"unit testing"},"article:published_time":"2015-07-08T07:59:02+00:00","article:modified_time":"2015-07-09T13:39:26+00:00","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Custom matcher for testing with Jasmine | TO THE NEW Blog","twitter:description":"Jasmine is a behavior-driven development framework for testing JavaScript code. Many Jasmine users only use the default set of matchers which are extremely powerful, yet are unable to meet our requirements when dealing with complicated or custom code. Jasmine provides a wide list of built-in matchers: Arrays: [javascript] expect(array).toBeArray(); expect(array).toBeArrayOfNumbers(); expect(array).toBeEmptyArray();[\/javascript] Booleans: [javascript] expect(boolean).toBeBoolean(); expect(boolean).toBeFalse();","twitter:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"21744","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"article","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 17:06:30","updated":"2024-02-29 09:28:21","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tCustom matcher for testing with Jasmine\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.today\/blog"},{"label":"Technology","link":"https:\/\/2thenew.today\/blog\/category\/technology\/"},{"label":"Custom matcher for testing with Jasmine","link":"https:\/\/2thenew.today\/blog\/make-custom-matcher-for-testing-with-jasmine\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/21744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/users\/149"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/comments?post=21744"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/21744\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/media?parent=21744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/categories?post=21744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/tags?post=21744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}