<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Fifty Words]]></title><description><![CDATA[Fifty Words]]></description><link>https://blog.fiftywords.co</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1664678621351/m4JTf-Ctx.png</url><title>Fifty Words</title><link>https://blog.fiftywords.co</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 02 May 2026 00:37:02 GMT</lastBuildDate><atom:link href="https://blog.fiftywords.co/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[The Array]]></title><description><![CDATA[An array is a numbered shelf for your data. Each item gets its own fixed slot, accessible instantly by its index number. This makes lookups incredibly fast. But the shelf has a fixed size; once it's full, you can't easily add more space. It’s a disci...]]></description><link>https://blog.fiftywords.co/array</link><guid isPermaLink="true">https://blog.fiftywords.co/array</guid><category><![CDATA[fixed size array]]></category><category><![CDATA[data structures]]></category><category><![CDATA[array]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[Programming basics]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 05 Oct 2025 23:24:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759704062290/7ffcb7b7-4902-4aa2-98bb-503c9c9dc762.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>An array is a numbered shelf for your data. Each item gets its own fixed slot, accessible instantly by its index number. This makes lookups incredibly fast. But the shelf has a <strong>fixed size</strong>; once it's full, you can't easily add more space. It’s a disciplined, efficient organizer.</p>
<pre><code class="lang-typescript"><span class="hljs-comment">// A shelf with three fixed slots</span>
<span class="hljs-keyword">const</span> numberedShelf: <span class="hljs-built_in">string</span>[] = [<span class="hljs-string">"Book"</span>, <span class="hljs-string">"Photo Frame"</span>, <span class="hljs-string">"Clock"</span>];

<span class="hljs-comment">// Instantly access the item at slot 0 (0-indexed)</span>
<span class="hljs-keyword">const</span> item = numberedShelf[<span class="hljs-number">0</span>]; <span class="hljs-comment">// "Book"</span>

<span class="hljs-comment">// Instantly access the item at slot 1 (0-indexed)</span>
<span class="hljs-keyword">const</span> item = numberedShelf[<span class="hljs-number">1</span>]; <span class="hljs-comment">// "Photo Frame"</span>

<span class="hljs-comment">// Instantly access the item at slot 2 (0-indexed)</span>
<span class="hljs-keyword">const</span> item = numberedShelf[<span class="hljs-number">2</span>]; <span class="hljs-comment">// "Clock"</span>
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/arreglo">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[E - Expected Value]]></title><description><![CDATA[It's the third section in the name.
It specifies what's the expected result after executing the unit of code under the simulated scenario.
/** In this example the three sections of the name are in the same text.
 * Airplane is the Unit under test
 * ...]]></description><link>https://blog.fiftywords.co/use-expected-value</link><guid isPermaLink="true">https://blog.fiftywords.co/use-expected-value</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 01:19:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/qDY9ahp0Mto/upload/v1666478079420/4Dh3wG7C2.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It's the third section in the <a target="_blank" href="https://blog.fiftywords.co/use">name</a>.</p>
<p>It specifies what's the expected result after executing the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a> under the simulated scenario.</p>
<pre><code class="lang-ts"><span class="hljs-comment">/** In this example the three sections of the name are in the same text.
 * Airplane is the Unit under test
 * takeOff without parameters is the scenario under test
 */</span>
test(<span class="hljs-string">"Airplane, takeOff without parameters, the airplane state should be FLYING after takeoff"</span>, <span class="hljs-function">() =&gt;</span> {});

<span class="hljs-comment">/** In this example the first section of the test name is in a group
 * because there will be multiple tests on the same unit.
 * takeOff without parameters is the scenario under test
 */</span>
group(<span class="hljs-string">"Airplane"</span>, <span class="hljs-function">() =&gt;</span> {
  group(<span class="hljs-string">"takeOff without parameters, the airplane state should be FLYING after takeoff"</span>, <span class="hljs-function">()=&gt;</span>);

  test(<span class="hljs-string">"takeOff with isRaining parameter set to true, , the airplane state should be FLYING after takeoff"</span>, <span class="hljs-function">() =&gt;</span> {});
});
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/use-efecto-esperado">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[S - Scenario]]></title><description><![CDATA[It's the second section in the name.
It specifies which case we're going to verify in the test including the details that make it relevant.
/** In this example the three sections of the name are in the same text.
 * Airplane is the Unit under test
 *...]]></description><link>https://blog.fiftywords.co/use-scenario</link><guid isPermaLink="true">https://blog.fiftywords.co/use-scenario</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 01:12:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/m3th3rIQ9-w/upload/v1666465516773/fR6_9fN8N.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It's the second section in the <a target="_blank" href="https://blog.fiftywords.co/use">name</a>.</p>
<p>It specifies which case we're going to verify in the <a target="_blank" href="https://blog.fiftywords.co/unit-test">test</a> including the details that make it relevant.</p>
<pre><code class="lang-ts"><span class="hljs-comment">/** In this example the three sections of the name are in the same text.
 * Airplane is the Unit under test
 * The xxx refer to the other section
 */</span>
test(<span class="hljs-string">"Airplane, takeOff without parameters, xxx"</span>, <span class="hljs-function">() =&gt;</span> {});

<span class="hljs-comment">/** In this example the first section of the test name is in a group
 * because there will be multiple tests on the same unit.
 * The xxx refer to the other sections
 */</span>
group(<span class="hljs-string">"Airplane"</span>, <span class="hljs-function">() =&gt;</span> {
  group(<span class="hljs-string">"takeOff without parameters, xxx"</span>, <span class="hljs-function">()=&gt;</span>);

  test(<span class="hljs-string">"takeOff with isRaining parameter set to true, xxx"</span>, <span class="hljs-function">() =&gt;</span> {});
});
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/use-situacion">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[U - Unit Under Test]]></title><description><![CDATA[It's the first section in the name.
It specifies which is the unit that we're currently testing.
The unit can be in the same text as the other sections or separated in a group if we're going to create multiple unit tests for the same unit of code.
/*...]]></description><link>https://blog.fiftywords.co/use-unit-under-test</link><guid isPermaLink="true">https://blog.fiftywords.co/use-unit-under-test</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 01:05:58 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/MJMqoesvtBk/upload/v1666460453336/aEek0uIIA.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It's the first section in the <a target="_blank" href="https://blog.fiftywords.co/use">name</a>.</p>
<p>It specifies which is the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit</a> that we're currently testing.</p>
<p>The <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit</a> can be in the same text as the other sections or separated in a group if we're going to create multiple <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit tests</a> for the same <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>.</p>
<pre><code class="lang-ts"><span class="hljs-comment">/** In this example the three sections of the name are in the same text.
 * The xxx refer to the other sections
 */</span>
test(<span class="hljs-string">"Airplane, xxx, xxx"</span>, <span class="hljs-function">() =&gt;</span> {});

<span class="hljs-comment">/** In this example the first section of the test name is in a group
 * because there will be multiple tests on the same unit.
 * The xxx refer to the other sections
 */</span>
group(<span class="hljs-string">"Airplane"</span>, <span class="hljs-function">() =&gt;</span> {
  test(<span class="hljs-string">"xxx, xxx"</span>, <span class="hljs-function">() =&gt;</span> {});

  test(<span class="hljs-string">"xxx, xxx"</span>, <span class="hljs-function">() =&gt;</span> {});
});
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/use-unidad-bajo-prueba">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[USE - Test Naming]]></title><description><![CDATA[It's the structure we use to name a unit test in a way that it’s identified and its context understood.Each letter represents a section:

Unit under test: Which unit are we testing?
Scenario or inputs to the unit: What situation are we simulating?
Ex...]]></description><link>https://blog.fiftywords.co/use</link><guid isPermaLink="true">https://blog.fiftywords.co/use</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 01:00:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/cHX_Eih2hkY/upload/v1666459223833/ZPYYm11jV.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It's the structure we use to name a <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit test</a> in a way that it’s identified and its context understood.<br />Each letter represents a section:</p>
<ul>
<li><a target="_blank" href="https://blog.fiftywords.co/use-unit-under-test">Unit under test</a>: Which <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit</a> are we testing?</li>
<li><a target="_blank" href="https://blog.fiftywords.co/use-scenario">Scenario or inputs to the unit</a>: What situation are we simulating?</li>
<li><a target="_blank" href="https://blog.fiftywords.co/use-expected-value">Expected value</a>: What's the expected result?</li>
</ul>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/use">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[Assert]]></title><description><![CDATA[In this section we verify that the unit of code, effectively, produces the expected result for the simulated situation.
Only one exit point must be verified for each unit test and it's that exit point this section is focused on.
test("the airplane st...]]></description><link>https://blog.fiftywords.co/assert</link><guid isPermaLink="true">https://blog.fiftywords.co/assert</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 00:49:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/1F4MukO0UNg/upload/v1665714242536/wn87WFB7b.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this section we verify that the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>, effectively, produces the expected result for the simulated situation.</p>
<p>Only one <a target="_blank" href="https://blog.fiftywords.co/exit-point">exit point</a> must be verified for each <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit test</a> and it's that <a target="_blank" href="https://blog.fiftywords.co/exit-point">exit point</a> this section is focused on.</p>
<pre><code class="lang-ts">test(<span class="hljs-string">"the airplane state should be FLYING after takeoff"</span>, <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-comment">/// Arrange</span>
  <span class="hljs-keyword">const</span> fakeEngine: IEngine = <span class="hljs-keyword">new</span> FakeEngine();
  <span class="hljs-keyword">const</span> fakeFuelTank: ITank = <span class="hljs-keyword">new</span> FakeTank();
  <span class="hljs-keyword">const</span> airplane: Airplane = <span class="hljs-keyword">new</span> Airplane(fakeEngine, fakeFuelTank);

  <span class="hljs-comment">/// Act</span>
  airplane.takeoff();

  <span class="hljs-comment">/**
   * Notice that we clearly mark the Assert section
   * and we compare the test actual result with
   * the expected result
   */</span>

  <span class="hljs-comment">/// Assert</span>
  assert(airplane.currentStatus, AirplaneStatus.FLYING);
});
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/afirmar">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[- Act -]]></title><description><![CDATA[In this section we execute the unit of code that we're going to test through its entry point by using the required parameters to simulate the situation we're going to verify in the unit test.
test("the airplane state should be FLYING after takeoff", ...]]></description><link>https://blog.fiftywords.co/act</link><guid isPermaLink="true">https://blog.fiftywords.co/act</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 00:37:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/n2NBgIx3A28/upload/v1665712442566/tWlXmnEtz.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this section we execute the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a> that we're going to test through its <a target="_blank" href="https://blog.fiftywords.co/entry-point">entry point</a> by using the required parameters to simulate the situation we're going to verify in the <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit test</a>.</p>
<pre><code class="lang-ts">test(<span class="hljs-string">"the airplane state should be FLYING after takeoff"</span>, <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-comment">/// Arrange</span>
  <span class="hljs-keyword">const</span> fakeEngine: IEngine = <span class="hljs-keyword">new</span> FakeEngine();
  <span class="hljs-keyword">const</span> fakeFuelTank: ITank = <span class="hljs-keyword">new</span> FakeTank();
  <span class="hljs-keyword">const</span> airplane: Airplane = <span class="hljs-keyword">new</span> Airplane(fakeEngine, fakeFuelTank);

  <span class="hljs-comment">/**
   * Notice that we clearly mark the Act section
   * and we invoke the unit of code we're going to
   * test
   */</span>

  <span class="hljs-comment">/// Act</span>
  airplane.takeoff();

  <span class="hljs-comment">/// Rest of the test</span>
});
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/actuar">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[Arrange]]></title><description><![CDATA[In this section we are in charge of initializing all the dependencies (real or test doubles) required to simulate the situation we are going to verify in the unit test.
test("the airplane state should be FLYING after takeoff", () => {
  /**
   * Noti...]]></description><link>https://blog.fiftywords.co/arrange</link><guid isPermaLink="true">https://blog.fiftywords.co/arrange</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 00:34:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/Oaqk7qqNh_c/upload/v1665710693128/5WbBUEgKA.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this section we are in charge of initializing all the dependencies (real or <a target="_blank" href="https://blog.fiftywords.co/test-double">test doubles</a>) required to simulate the situation we are going to verify in the <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit test</a>.</p>
<pre><code>test(<span class="hljs-string">"the airplane state should be FLYING after takeoff"</span>, <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-comment">/**
   * Notice that we clearly mark the Arrange section
   * and we initialize in that section all the required
   * dependencies for creating the unit that we'll be
   * testing (An Airplane instance, in this case)
   */</span>

  <span class="hljs-comment">/// Arrange</span>
  <span class="hljs-keyword">const</span> fakeEngine: IEngine = <span class="hljs-keyword">new</span> FakeEngine();
  <span class="hljs-keyword">const</span> fakeFuelTank: ITank = <span class="hljs-keyword">new</span> FakeTank();
  <span class="hljs-keyword">const</span> airplane: Airplane = <span class="hljs-keyword">new</span> Airplane();

  <span class="hljs-comment">/// Rest of the test</span>
});
</code></pre><p><a target="_blank" href="https://blog.cincuentapalabras.co/arreglar">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[AAA - Test Structure]]></title><description><![CDATA[It's the structure used for a unit test.
Each letter stands for a section:

Arrange: The dependencies to simulate the situation to verify.
Act: Execute the unit of code.
Assert: That the final result is as expected.

It's suggested that each section ...]]></description><link>https://blog.fiftywords.co/aaa</link><guid isPermaLink="true">https://blog.fiftywords.co/aaa</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 00:28:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/_LZbDkRaedE/upload/v1665709426115/KhUw5dfrGt.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It's the structure used for a <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit test</a>.</p>
<p>Each letter stands for a section:</p>
<ul>
<li><a target="_blank" href="https://blog.fiftywords.co/arrange">Arrange</a>: The dependencies to simulate the situation to verify.</li>
<li><a target="_blank" href="https://blog.fiftywords.co/act">Act</a>: Execute the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>.</li>
<li><a target="_blank" href="https://blog.fiftywords.co/assert">Assert</a>: That the final result is as expected.</li>
</ul>
<p>It's suggested that each section is well marked in the <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit test</a>.</p>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/aaa">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[- Stub -]]></title><description><![CDATA[Test double used to simulate an external dependency that sends information into the unit of code.
It lets us control the info received by the unit of code.
Multiple Stubs can exist in a test.
Given that it inserts information into the test WE DO NOT ...]]></description><link>https://blog.fiftywords.co/stub</link><guid isPermaLink="true">https://blog.fiftywords.co/stub</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[tests]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 00:14:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/rTwhmFSoXC8/upload/v1665017214689/JVvg4I-dp.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://blog.fiftywords.co/test-double">Test double</a> used to simulate an external dependency that <strong>sends</strong> information into the <a target="_blank" href="https://blog.fiftywords.co/test-double">unit of code</a>.</p>
<p>It lets us control the info received by the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>.</p>
<p>Multiple Stubs can exist in a <a target="_blank" href="https://blog.fiftywords.co/unit-test">test</a>.</p>
<p>Given that it inserts information into the <a target="_blank" href="https://blog.fiftywords.co/unit-test">test</a> WE DO NOT VALIDATE OVER STUBS.</p>
<pre><code class="lang-ts"><span class="hljs-keyword">class</span> Person {
  <span class="hljs-keyword">constructor</span>(<span class="hljs-params"><span class="hljs-keyword">private</span> _name: <span class="hljs-built_in">string</span>, <span class="hljs-keyword">private</span> _lastname: <span class="hljs-built_in">string</span></span>) {}

  <span class="hljs-keyword">public</span> get name() {
    <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>._name;
  }

  <span class="hljs-keyword">public</span> get lastname() {
    <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>._lastname;
  }
}

<span class="hljs-comment">/**
 * Interface required for reading people from a db
 * */</span>
<span class="hljs-keyword">interface</span> IPersonDBReader {
  readAllPeople(): <span class="hljs-built_in">Promise</span>&lt;<span class="hljs-built_in">Array</span>&lt;Person&gt;&gt;;
}

<span class="hljs-comment">/**
 * Stub implementation for IPersonDBReader
 * With this stub we can simulate that a DB returned certain people
 */</span>
<span class="hljs-keyword">class</span> StubPersonDBReader <span class="hljs-keyword">implements</span> IPersonDBReader {
  <span class="hljs-keyword">constructor</span>(<span class="hljs-params"><span class="hljs-keyword">private</span> people: <span class="hljs-built_in">Array</span>&lt;Person&gt;</span>) {}

  <span class="hljs-keyword">async</span> readAllPeople(): <span class="hljs-built_in">Promise</span>&lt;Person[]&gt; {
    <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.people;
  }
}

<span class="hljs-comment">/**
 * Real class that we're going to test
 */</span>
<span class="hljs-keyword">class</span> PersonMapper {
  <span class="hljs-comment">/**
   * Initializes a PersonMapper instance
   * @param _personDBReader data source to read people from
   */</span>
  <span class="hljs-keyword">constructor</span>(<span class="hljs-params"><span class="hljs-keyword">private</span> _personDBReader: IPersonDBReader</span>) {
    <span class="hljs-comment">/**
     * Please notice that we're expecting an IPersonDBReader instance.
     * That is the actual trick that allows us to send a Stub to simulate
     * a real DB with our fake data
     */</span>
  }

  <span class="hljs-comment">/** Method from PersonMapper that we want to test */</span>
  <span class="hljs-keyword">async</span> mapPersonToFullName(): <span class="hljs-built_in">Promise</span>&lt;<span class="hljs-built_in">Array</span>&lt;<span class="hljs-built_in">String</span>&gt;&gt; {
    <span class="hljs-keyword">const</span> people = <span class="hljs-keyword">await</span> <span class="hljs-built_in">this</span>._personDBReader.readAllPeople();

    <span class="hljs-keyword">return</span> people.map(<span class="hljs-function">(<span class="hljs-params">person: Person</span>) =&gt;</span> <span class="hljs-string">`<span class="hljs-subst">${person.name}</span> <span class="hljs-subst">${person.lastname}</span>`</span>);
  }
}

<span class="hljs-comment">/** Test Beginning */</span>

<span class="hljs-comment">/** Initialize two people for the test */</span>
<span class="hljs-keyword">const</span> freddieMercury = <span class="hljs-keyword">new</span> Person(<span class="hljs-string">"Freddie"</span>, <span class="hljs-string">"Mercury"</span>);
<span class="hljs-keyword">const</span> brianMay = <span class="hljs-keyword">new</span> Person(<span class="hljs-string">"Brian"</span>, <span class="hljs-string">"May"</span>);

<span class="hljs-comment">/** Create a Stub to simulate that two people are read from the DB into the PersonMapper*/</span>
<span class="hljs-keyword">const</span> stubPersonDBReader: IPersonDBReader = <span class="hljs-keyword">new</span> StubPersonDBReader([
  freddieMercury,
  brianMay,
]);

<span class="hljs-comment">/** Send StubPersonDBReader object to PersonMapper via constructor */</span>
<span class="hljs-keyword">const</span> personMapper: PersonMapper = <span class="hljs-keyword">new</span> PersonMapper(stubPersonDBReader);

<span class="hljs-comment">/** Call mapPersonToFullName method to test that it's correctly mapping each person to a fullName */</span>
personMapper.mapPersonToFullName().then(<span class="hljs-function">(<span class="hljs-params">fullNames</span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> expectedFullNames = [<span class="hljs-string">"Freddie Mercury"</span>, <span class="hljs-string">"Brian May"</span>];
  fullNames.forEach(<span class="hljs-function">(<span class="hljs-params">item, index</span>) =&gt;</span> {
    <span class="hljs-comment">/** Simulate test result validation */</span>
    item === expectedFullNames[index];
  });
});

<span class="hljs-comment">/** Test End */</span>
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/stub">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[- Mock -]]></title><description><![CDATA[Test double used to simulate an external dependency that receives information sent by the unit of code.
It allows to validate that information..
It can only exist ONE MOCK at most per test, given that it simulates an exit point and only one is verifi...]]></description><link>https://blog.fiftywords.co/mock</link><guid isPermaLink="true">https://blog.fiftywords.co/mock</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 00:08:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/ARWAWkJ68kA/upload/v1665016985386/KlcqnbRdxg.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://blog.fiftywords.co/test-double">Test double</a> used to simulate an <a target="_blank" href="https://blog.fiftywords.co/external-dependency-exit-point">external dependency</a> that <strong>receives</strong> information sent by the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>.</p>
<p>It allows to validate that information..</p>
<p>It can only exist <strong>ONE MOCK</strong> at most per test, given that it simulates an <a target="_blank" href="https://blog.fiftywords.co/exit-point">exit point</a> and only one is verified per <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit test</a></p>
<pre><code class="lang-ts"><span class="hljs-comment">/** Interface tha defines an external dependency */</span>
<span class="hljs-keyword">interface</span> ILogger {
  logInfo(info: <span class="hljs-built_in">string</span>);
}

<span class="hljs-comment">/** Real implementation for ILogger interface */</span>
<span class="hljs-keyword">class</span> RealLogger <span class="hljs-keyword">implements</span> ILogger {
  <span class="hljs-keyword">public</span> logInfo(info: <span class="hljs-built_in">string</span>) {
    <span class="hljs-built_in">console</span>.log(info);
  }
}

<span class="hljs-comment">/** Mock implementation to verify
 * Calculator.add is logging properly */</span>
<span class="hljs-keyword">class</span> MockLogger <span class="hljs-keyword">implements</span> ILogger {
  <span class="hljs-comment">/** Private field to store last logged info */</span>
  <span class="hljs-keyword">private</span> receivedInfoToLog: <span class="hljs-built_in">string</span>;

  <span class="hljs-comment">/** Method defined by ILogger interface */</span>
  <span class="hljs-keyword">public</span> logInfo(info: <span class="hljs-built_in">string</span>) {
    <span class="hljs-comment">/** Assign received info to this.receivedInfoToLog
     * so we can later verify that Calculator.add sent
     * the right info
     */</span>
    <span class="hljs-built_in">this</span>.receivedInfoToLog = info;
  }

  <span class="hljs-comment">/** Give access to validate latest logged info */</span>
  <span class="hljs-keyword">public</span> get loggedInfo(): <span class="hljs-built_in">string</span> {
    <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.receivedInfoToLog;
  }
}

<span class="hljs-keyword">class</span> Calculator {
  <span class="hljs-comment">/** Costructor receiving an ILogger implementation */</span>
  <span class="hljs-keyword">constructor</span>(<span class="hljs-params"><span class="hljs-keyword">private</span> logger: ILogger</span>) {}

  <span class="hljs-keyword">public</span> add(summand: <span class="hljs-built_in">number</span>, otherSummand: <span class="hljs-built_in">number</span>): <span class="hljs-built_in">number</span> {
    <span class="hljs-comment">/** Uses received ILogger implementation to log info
     * related to addition */</span>
    <span class="hljs-built_in">this</span>.logger.logInfo(<span class="hljs-string">`Will add <span class="hljs-subst">${summand}</span> and <span class="hljs-subst">${otherSummand}</span>`</span>);
    <span class="hljs-keyword">return</span> summand + otherSummand;
  }
}

<span class="hljs-comment">/** Test Beginning */</span>

<span class="hljs-comment">/** Initializes a MockLogger object to validate
 * Calculator is properly logging data */</span>
<span class="hljs-keyword">const</span> mockLogger: MockLogger = <span class="hljs-keyword">new</span> MockLogger();
<span class="hljs-comment">/** Send MockLogger object to Calculator via constructor */</span>
<span class="hljs-keyword">const</span> calculator: Calculator = <span class="hljs-keyword">new</span> Calculator(mockLogger);
<span class="hljs-comment">/** Call add method to test that it's correctly logging the info */</span>
calculator.add(<span class="hljs-number">4</span>, <span class="hljs-number">5</span>);

<span class="hljs-comment">/** Verify that the logged info is as expected */</span>
mockLogger.loggedInfo === <span class="hljs-string">"Will add 4 and 5"</span>;

<span class="hljs-comment">/** Test End */</span>
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/mock">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[Test Double]]></title><description><![CDATA[Description:
Fake object that help us simulate the situation required for a unit test.
Types:

Mock
Stub

They are not mandatory for tests but are very useful for those cases where using a real object is complex for the situation we want to simulate....]]></description><link>https://blog.fiftywords.co/test-double</link><guid isPermaLink="true">https://blog.fiftywords.co/test-double</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sun, 23 Oct 2022 00:03:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/1P6LZ8S8XJc/upload/v1664851662016/ShN76wHND.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Description</strong>:</p>
<p>Fake object that help us simulate the situation required for a <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit test</a>.</p>
<p><strong>Types</strong>:</p>
<ul>
<li><a target="_blank" href="https://blog.fiftywords.co/mock">Mock</a></li>
<li><a target="_blank" href="https://blog.fiftywords.co/stub">Stub</a></li>
</ul>
<p>They are not mandatory for tests but are very useful for those cases where using a real object is complex for the situation we want to simulate.</p>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/doble-de-prueba">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[External Dependency, call to]]></title><description><![CDATA[Call to an external dependency is, as it's name explains, an interaction in which a unit of code sends information to an external dependency such as:

Database
HTTP API
RPC

function additionWithLogging(
  summand: number,
  otherSummand: number,
  l...]]></description><link>https://blog.fiftywords.co/external-dependency-exit-point</link><guid isPermaLink="true">https://blog.fiftywords.co/external-dependency-exit-point</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sat, 22 Oct 2022 23:59:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/f4UbPVbJcjw/upload/v1664758709854/9TpkheEus.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Call to an external dependency is, as it's name explains, an interaction in which a <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a> <strong>sends</strong> information to an external dependency such as:</p>
<ul>
<li>Database</li>
<li>HTTP API</li>
<li>RPC</li>
</ul>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">additionWithLogging</span>(<span class="hljs-params">
  summand: number,
  otherSummand: number,
  logger: ILogger
</span>): <span class="hljs-title">number</span> </span>{
  <span class="hljs-comment">/** Exit point =&gt; external dependency call */</span>
  logger.log(<span class="hljs-string">`Will add: <span class="hljs-subst">${currentValue}</span> + <span class="hljs-subst">${summand}</span>`</span>);

  <span class="hljs-keyword">return</span> otherSummand + summand;
}
</code></pre><p>To verify it a <a target="_blank" href="https://blog.fiftywords.co/test-double">test double</a> is used, in this case a <a target="_blank" href="https://blog.fiftywords.co/mock">mock</a>.</p>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/dependencia-externa-punto-de-salida">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[Effect, change of state]]></title><description><![CDATA[State change is a secondary effect generated by executing a unit of code.
To validate the result we must access the state that has changed, so it is compromised of three steps:

Execute the unit of code
Access the changed state  
Verify the value is ...]]></description><link>https://blog.fiftywords.co/change-of-state-exit-point</link><guid isPermaLink="true">https://blog.fiftywords.co/change-of-state-exit-point</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sat, 22 Oct 2022 23:52:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/VlTJdP8ZY1c/upload/v1664755191104/xT7LoIjcV.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>State change is a secondary effect generated by executing a <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>.</p>
<p>To validate the result we must access the state that has changed, so it is compromised of three steps:</p>
<ul>
<li>Execute the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a></li>
<li>Access the changed state  </li>
<li>Verify the value is as expected</li>
</ul>
<pre><code class="lang-ts"><span class="hljs-comment">/** State that is changed */</span>
<span class="hljs-keyword">let</span> currentValue = <span class="hljs-number">0</span>;

<span class="hljs-comment">/** Unit of code that has an effect.
 * It changes currentValue
 */</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params">summand: <span class="hljs-built_in">number</span></span>): <span class="hljs-title">void</span> </span>{
  <span class="hljs-comment">/**
   * Exit point =&gt; Effect, Change of state
   */</span>
  currentValue += summand;
}

<span class="hljs-comment">/**
 * Way to access current state
 */</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getCurrentValue</span>(<span class="hljs-params"></span>): <span class="hljs-title">number</span> </span>{
  <span class="hljs-keyword">return</span> currentValue;
}

<span class="hljs-comment">/** Execute unit of code */</span>
sumar(<span class="hljs-number">5</span>);

<span class="hljs-comment">/** Access changed state */</span>
<span class="hljs-keyword">const</span> valorAcumulado = obtenerValorActual();
<span class="hljs-comment">/** Verify obtained value is what we expect */</span>
valorAcumulado === <span class="hljs-number">5</span>;
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/cambio-de-estado-punto-de-salida">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[Return value]]></title><description><![CDATA[Return value is the result directly obtained after executing a unit of code, usually denoted by the reserved word return
It's the easiest exit point to verify because, after getting the value returned by the unit of code, we can compare it with the e...]]></description><link>https://blog.fiftywords.co/return-value-exit-point</link><guid isPermaLink="true">https://blog.fiftywords.co/return-value-exit-point</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sat, 22 Oct 2022 23:46:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/sckLONKzPJM/upload/v1664748007297/7wBH7D6f9.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Return value is the result directly obtained after executing a <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>, usually denoted by the reserved word <code>return</code></p>
<p>It's the easiest <a target="_blank" href="https://blog.fiftywords.co/exit-point">exit point</a> to verify because, after getting the value returned by the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>, we can compare it with the expected result.</p>
<pre><code class="lang-ts"><span class="hljs-comment">/** 
 * It's common to point the return type in the entry point (signature)
 * In this case is the last ```number``` that specifies 
 * what type this unit of code returns.
 */</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params">summand: <span class="hljs-built_in">number</span>, otherSummand: <span class="hljs-built_in">number</span></span>): <span class="hljs-title">number</span> </span>{
  <span class="hljs-comment">/** Return value exit point */</span>
  <span class="hljs-keyword">return</span> summand + otherSummand;
}
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/valor-de-retorno-punto-de-salida">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[Exit Point]]></title><description><![CDATA[Description:
Result (verifiable externally) obtained by executing a unit of code.
Types (RED):

Return value. (Easiest to verify).
Effect, change of state
Dependency, call to external. (Hardest to verify)

let currentValue = 0;

function additionWith...]]></description><link>https://blog.fiftywords.co/exit-point</link><guid isPermaLink="true">https://blog.fiftywords.co/exit-point</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sat, 22 Oct 2022 23:35:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/kFOTEAm6QuY/upload/v1664743181745/-6yGNVvOn.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Description</strong>:</p>
<p>Result (verifiable externally) obtained by executing a <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>.</p>
<p><strong>Types (RED)</strong>:</p>
<ul>
<li><a target="_blank" href="https://blog.fiftywords.co/return-value-exit-point">Return value</a>. (Easiest to verify).</li>
<li><a target="_blank" href="https://blog.fiftywords.co/change-of-state-exit-point">Effect, change of state</a></li>
<li><a target="_blank" href="https://blog.fiftywords.co/external-dependency-exit-point">Dependency, call to external</a>. (Hardest to verify)</li>
</ul>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> currentValue = <span class="hljs-number">0</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">additionWithLogging</span>(<span class="hljs-params">summand: <span class="hljs-built_in">number</span>, logger: ILogger</span>): <span class="hljs-title">number</span> </span>{
  <span class="hljs-comment">/** Exit point 1 =&gt; external dependency call (D) */</span>
  logger.log(<span class="hljs-string">`Will add: <span class="hljs-subst">${currentValue}</span> + <span class="hljs-subst">${summand}</span>`</span>);
  <span class="hljs-comment">/** Exit point 2 =&gt; effect, change of state (E) */</span>
  currentValue += summand;

  <span class="hljs-comment">/** Exit point 3 =&gt; return value (R) */</span>
  <span class="hljs-keyword">return</span> currentValue;
}
</code></pre>
<p>Every <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a> has exit point(s).</p>
<p><strong>Only one exit point is verified per <a target="_blank" href="https://blog.fiftywords.co/unit-test">unit test</a></strong></p>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/punto-de-salida">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[- Body -]]></title><description><![CDATA[Instructions set to be executed in a unit of code.
It can be as complex as required, calling multiple functions, modules, etc.
function complexFunction(): number {
  /**
   * Beginning of the unit of code's body
   */
  const firstReturnValue = calTo...]]></description><link>https://blog.fiftywords.co/body-unit-of-code</link><guid isPermaLink="true">https://blog.fiftywords.co/body-unit-of-code</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sat, 22 Oct 2022 23:28:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/F4cJtI7HCMw/upload/v1664735446315/kaSDF1YBa.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Instructions set to be executed in a <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a>.</p>
<p>It can be as complex as required, calling multiple functions, modules, etc.</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">complexFunction</span>(<span class="hljs-params"></span>): <span class="hljs-title">number</span> </span>{
  <span class="hljs-comment">/**
   * Beginning of the unit of code's body
   */</span>
  <span class="hljs-keyword">const</span> firstReturnValue = calToAnotherFunction();
  <span class="hljs-keyword">const</span> preResult = module1.externalFunction(firstReturnValue);
  <span class="hljs-keyword">const</span> result = preResult.calculate();

  <span class="hljs-keyword">return</span> result;
  <span class="hljs-comment">/**
   * End of the unit of code's body
   */</span>
}
</code></pre><p><a target="_blank" href="https://blog.cincuentapalabras.co/cuerpo-unidad-de-codigo">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[Entry Point]]></title><description><![CDATA[PUBLIC interface through which we can communicate with a unit of code to trigger its process.
Indicates the name, received parameters and the return type obtained when the unit of code is executed.
A unit of code ONLY HAS ONE ENTRY POINT
/** Entry po...]]></description><link>https://blog.fiftywords.co/entry-point</link><guid isPermaLink="true">https://blog.fiftywords.co/entry-point</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sat, 22 Oct 2022 23:19:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/16YxCJSoAek/upload/v1664732837183/TjVKFdJf6.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>PUBLIC</strong> interface through which we can communicate with a <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a> to trigger its process.</p>
<p>Indicates the name, received parameters and the return type obtained when the <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a> is executed.</p>
<p>A <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a> <strong>ONLY HAS ONE ENTRY POINT</strong></p>
<pre><code class="lang-ts"><span class="hljs-comment">/** Entry point */</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params">summand: <span class="hljs-built_in">number</span>, otherSummand: <span class="hljs-built_in">number</span></span>): <span class="hljs-title">number</span> </span>{
  <span class="hljs-keyword">return</span> summand + otherSummand;
}
</code></pre>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/punto-de-entrada">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[Unit of Code]]></title><description><![CDATA[Description:
Instructions executed from a process' entry point until its ending with a verifiable result through one or multiple exit points.
Composition:

Entry point
Body
Exit point(s)

class Calculator {
  private currentResult: number = 0;

  // ...]]></description><link>https://blog.fiftywords.co/unit-of-code</link><guid isPermaLink="true">https://blog.fiftywords.co/unit-of-code</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit test]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sat, 22 Oct 2022 23:16:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/lFtttcsx5Vk/upload/v1664722974885/CwL6EtB9_.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Description</strong>:</p>
<p>Instructions executed from a process' entry point until its ending with a verifiable result through one or multiple exit points.</p>
<p><strong>Composition</strong>:</p>
<ul>
<li><a target="_blank" href="https://blog.fiftywords.co/entry-point">Entry point</a></li>
<li><a target="_blank" href="https://blog.fiftywords.co/body-unit-of-code">Body</a></li>
<li><a target="_blank" href="https://blog.fiftywords.co/exit-point">Exit point(s)</a></li>
</ul>
<pre><code><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Calculator</span> </span>{
  private currentResult: number = <span class="hljs-number">0</span>;

  <span class="hljs-comment">// Entry point for the unit of code *add*</span>
  public add(summand: number): number {
    <span class="hljs-comment">/**
     * Beginning of the unit of code's body
     */</span>

    <span class="hljs-comment">// Exit point</span>
    <span class="hljs-built_in">this</span>.currentResult += summand;

    <span class="hljs-comment">// Another exit point</span>
    <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.currentResult;

    <span class="hljs-comment">/**
     * End of the unit of code's body
     */</span>
  }
}
</code></pre><p><strong>Examples</strong>:</p>
<ul>
<li>A function</li>
<li>An object method</li>
<li>A module feature</li>
</ul>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/unidad-de-codigo">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item><item><title><![CDATA[Unit Test]]></title><description><![CDATA[Description:
Validates that a unit of code behaves correctly in a simulated situation.
Features:

VERY fast
Run 100% in memory
Replicable in any environment
Independent from other unit tests
Run before, during and after development
Only validates one...]]></description><link>https://blog.fiftywords.co/unit-test</link><guid isPermaLink="true">https://blog.fiftywords.co/unit-test</guid><category><![CDATA[unit testing]]></category><category><![CDATA[unit tests]]></category><category><![CDATA[Testing]]></category><category><![CDATA[test]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Juan E Quintero R]]></dc:creator><pubDate>Sat, 22 Oct 2022 23:11:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/aVvZJC0ynBQ/upload/v1664719776514/jrijl8nSa.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Description</strong>:</p>
<p>Validates that a <a target="_blank" href="https://blog.fiftywords.co/unit-of-code">unit of code</a> behaves correctly in a simulated situation.</p>
<p><strong>Features</strong>:</p>
<ul>
<li>VERY fast</li>
<li>Run 100% in memory</li>
<li>Replicable in any environment</li>
<li>Independent from other unit tests</li>
<li>Run before, during and after development</li>
<li>Only validates one condition (per unit test): <a target="_blank" href="https://blog.fiftywords.co/exit-point">RED</a></li>
</ul>
<p><strong>Structure</strong>:</p>
<p><a target="_blank" href="https://blog.fiftywords.co/aaa">AAA</a></p>
<p><strong>Name structure</strong>:</p>
<p><a target="_blank" href="https://blog.fiftywords.co/use">USE</a></p>
<p><a target="_blank" href="https://blog.cincuentapalabras.co/prueba-unitaria">🇨🇴 Versión en Español</a></p>
]]></content:encoded></item></channel></rss>