UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

75 lines (63 loc) 2.44 kB
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>The source code</title> <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="../resources/prettify/prettify.js"></script> <style type="text/css"> .highlight { display: block; background-color: #ddd; } </style> <script type="text/javascript"> function highlight() { document.getElementById(location.hash.replace(/#/, "")).className = "highlight"; } </script> </head> <body onload="prettyPrint(); highlight();"> <pre class="prettyprint lang-js">/* Siesta 5.6.1 Copyright(c) 2009-2022 Bryntum AB https://bryntum.com/contact https://bryntum.com/products/siesta/license */ <span id='Siesta-Test-Date'>/** </span>@class Siesta.Test.Date A mixin with the additinal assertions for dates. Being consumed by {@link Siesta.Test} */ Role(&#39;Siesta.Test.Date&#39;, { methods : { isDateEq: function (got, expectedDate, description) { this.isDateEqual.apply(this, arguments); }, <span id='Siesta-Test-Date-method-isDateEqual'> /** </span> * This assertion passes when the 2 provided dates are equal and fails otherwise. * * It has a synonym: `isDateEq` * * @param {Date} got The 1st date to compare * @param {Date} expectedDate The 2nd date to compare * @param {String} [description] The description of the assertion */ isDateEqual: function (got, expectedDate, description) { var R = Siesta.Resource(&#39;Siesta.Test.Date&#39;); if (got - expectedDate === 0) { this.pass(description, { descTpl : &#39;{got} &#39; + R.get(&#39;isEqualTo&#39;) + &#39; {expectedDate}&#39;, got : got, expectedDate : expectedDate }); } else { this.fail(description, { assertionName : &#39;isDateEqual&#39;, got : got ? got.toString() : &#39;&#39;, gotDesc : R.get(&#39;Got&#39;), need : expectedDate.toString() }); } } } }); </pre> </body> </html>