<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mahsa</title>
    <description>The latest articles on DEV Community by Mahsa (@mahsamilani).</description>
    <link>https://dev.to/mahsamilani</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4185879%2F0f676d23-6528-4c20-8aac-7ee85a7375ef.jpeg</url>
      <title>DEV Community: Mahsa</title>
      <link>https://dev.to/mahsamilani</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahsamilani"/>
    <language>en</language>
    <item>
      <title>Build in public</title>
      <dc:creator>Mahsa</dc:creator>
      <pubDate>Thu, 15 Oct 2026 04:44:29 +0000</pubDate>
      <link>https://dev.to/mahsamilani/build-in-public-91a</link>
      <guid>https://dev.to/mahsamilani/build-in-public-91a</guid>
      <description>&lt;p&gt;While building ShopPilot AI, I’ve been working on a function that checks availability for a requested product color and size.&lt;/p&gt;

&lt;p&gt;“Out of stock” and “that variant doesn’t exist” need different answers.&lt;/p&gt;

&lt;p&gt;I defined three cases to test:&lt;br&gt;
• The variant exists and has stock.&lt;br&gt;
• The variant exists but has zero stock.&lt;br&gt;
• There’s no matching variant.&lt;/p&gt;

&lt;p&gt;The interesting part was the third case. &lt;/p&gt;

&lt;p&gt;JavaScript’s .find() returns undefined when nothing matches, so I need to handle that before reading the variant’s stock.&lt;/p&gt;

&lt;p&gt;This is a small function, but it’s helping me connect JavaScript fundamentals, TypeScript, and testing to a real customer question.&lt;/p&gt;

&lt;p&gt;I’m learning how to use TDD for this logic: define the expected behavior with a failing test, implement it, then refactor.&lt;/p&gt;

&lt;p&gt;My main lesson so far: a useful test starts with a clear requirement. &lt;br&gt;
Before checking whether the code works, I need to decide what it should do.&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>testing</category>
      <category>typescript</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
