<?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: SonicDev</title>
    <description>The latest articles on DEV Community by SonicDev (@jacobporci).</description>
    <link>https://dev.to/jacobporci</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F512112%2Fb7390904-9070-4c81-b3af-fc2222522ceb.JPG</url>
      <title>DEV Community: SonicDev</title>
      <link>https://dev.to/jacobporci</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jacobporci"/>
    <language>en</language>
    <item>
      <title>My Experience Interviewing for a Senior Software Engineer Role</title>
      <dc:creator>SonicDev</dc:creator>
      <pubDate>Fri, 28 Feb 2025 03:42:44 +0000</pubDate>
      <link>https://dev.to/jacobporci/my-experience-interviewing-for-a-senior-software-engineer-role-1lg1</link>
      <guid>https://dev.to/jacobporci/my-experience-interviewing-for-a-senior-software-engineer-role-1lg1</guid>
      <description>&lt;p&gt;Early in 2025, I applied for a &lt;strong&gt;Senior/Principal Software Engineer&lt;/strong&gt; position at a hospitality-focused company. The role aligned well with my experience—&lt;strong&gt;7 years in software engineering&lt;/strong&gt; with expertise in &lt;strong&gt;ReactJS, NextJS, NodeJS, Prisma, and Postgres&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Interview Challenge
&lt;/h2&gt;

&lt;p&gt;During the interview, the &lt;strong&gt;Engineering Manager&lt;/strong&gt; presented me with an MVP for a multi-tenant e-commerce application, along with an &lt;strong&gt;API architecture diagram&lt;/strong&gt; and an &lt;strong&gt;Entity Relationship (ER) diagram&lt;/strong&gt;. My task? Plan and design a feature for offers/discounts based on a client request.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Approach
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Clarifying the Requirements&lt;/strong&gt;&lt;br&gt;
I started by asking key questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are the offers exclusive to this client?

&lt;ul&gt;
&lt;li&gt;No. The feature should be scalable for future clients, but offers are exclusive to VIPs.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Designing the Database&lt;/strong&gt;&lt;br&gt;
Since VIP access and offers were the core elements, I decided to introduce two new tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Offers (to store discount details)&lt;/li&gt;
&lt;li&gt;VIPs (to manage eligible customers)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Defining Frontend &amp;amp; Backend Tasks&lt;/strong&gt;&lt;br&gt;
To implement the feature, I outlined key development tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frontend:

&lt;ul&gt;
&lt;li&gt;Add VIP selection to the maintenance page&lt;/li&gt;
&lt;li&gt;Add an offers configuration section&lt;/li&gt;
&lt;li&gt;Display applicable offers on the customer-facing page&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Backend:

&lt;ul&gt;
&lt;li&gt;Implement API functions for CRUD operations on offers&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Follow-up Questions &amp;amp; My Responses
&lt;/h2&gt;

&lt;p&gt;During the discussion, the Engineering Manager asked some thought-provoking follow-ups:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;"How can we support different types of offers?"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I went blank for a second, unsure of what they meant. They guided me to add a type column in the Offers table to support multiple offer types.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;"How would you deploy this to production?"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Assuming the pipeline was already set up, I explained that I would create a release and let the pipeline handle the rest—&lt;strong&gt;running tests, building, and deploying.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;"How do you define success for this feature?"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I initially answered, "If all the acceptance criteria in the ticket are met, then the feature is successful."&lt;/li&gt;
&lt;li&gt;I added that built-in analytics could provide insights—if the feature receives significant engagement (e.g., clicks or redemptions), it indicates &lt;strong&gt;real usage and value&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  My Reflections
&lt;/h2&gt;

&lt;p&gt;Looking back, I feel I did okay, but there were areas where I could have done better. I covered the software development lifecycle well, but I could have been more structured in handling unexpected questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Outcome
&lt;/h2&gt;

&lt;p&gt;I didn’t make it to the next step 🥹—but I took away valuable lessons from the experience.&lt;/p&gt;

&lt;p&gt;What do you think of this interview? Have you ever had a similar experience?&lt;/p&gt;

</description>
      <category>fullstack</category>
      <category>softwareengineering</category>
      <category>interview</category>
      <category>product</category>
    </item>
    <item>
      <title>Deploying NextJS app to mobile App Stores using CapacitorJS</title>
      <dc:creator>SonicDev</dc:creator>
      <pubDate>Tue, 04 Jun 2024 03:51:32 +0000</pubDate>
      <link>https://dev.to/jacobporci/deploying-nextjs-app-to-mobile-app-stores-using-capacitorjs-215c</link>
      <guid>https://dev.to/jacobporci/deploying-nextjs-app-to-mobile-app-stores-using-capacitorjs-215c</guid>
      <description>&lt;h2&gt;
  
  
  Have you ever thought of having a single codebase for your web and mobile apps?
&lt;/h2&gt;

&lt;p&gt;I was recently tasked with a SPIKE ticket to research the gap analysis of getting our app to Google Play and App Store. What immediately popped up in my head was &lt;code&gt;react-native&lt;/code&gt;. So I searched for popular frameworks that supported this. The top choice was &lt;a href="https://solito.dev/" rel="noopener noreferrer"&gt;Solito&lt;/a&gt;. It solved 2 things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NextJS navigation on mobile&lt;/li&gt;
&lt;li&gt;patterns to build cross-platform apps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The problem was I had to rewrite a lot of code to convert it to &lt;code&gt;react-native-web&lt;/code&gt; to support native components.&lt;br&gt;
So I asked around the team for some perspective. One suggested &lt;a href="https://capacitorjs.com/" rel="noopener noreferrer"&gt;CapacitorJS by Ionic&lt;/a&gt;. It was the perfect solution for the requirement!&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic setup with my NextJS app
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;basically, follow this guide &lt;a href="https://capacitorjs.com/docs/getting-started" rel="noopener noreferrer"&gt;https://capacitorjs.com/docs/getting-started&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Few things to make your life easier
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use JDK 17 (this is the best version to use with Android to prevent Gradle build issues)

&lt;ul&gt;
&lt;li&gt;Use this guide to change your default version &lt;a href="https://stackoverflow.com/a/24657630" rel="noopener noreferrer"&gt;https://stackoverflow.com/a/24657630&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Create an &lt;code&gt;index.html&lt;/code&gt; file inside your &lt;code&gt;/public&lt;/code&gt; dir that contains:
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;see the note here why you have to do this &lt;a href="https://capacitorjs.com/docs/getting-started#add-capacitor-to-your-web-app" rel="noopener noreferrer"&gt;https://capacitorjs.com/docs/getting-started#add-capacitor-to-your-web-app&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common build errors with &lt;code&gt;npx cap sync&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;if &lt;code&gt;/out&lt;/code&gt; dir is missing, you have to update your &lt;code&gt;next.config.js&lt;/code&gt; to include &lt;code&gt;output: export&lt;/code&gt; instead of &lt;code&gt;output: standalone&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;if Gradle build errors, check if you are using the correct JDK version&lt;/li&gt;
&lt;li&gt;if iOS error

&lt;ul&gt;
&lt;li&gt;update your XCode&lt;/li&gt;
&lt;li&gt;install cocoapods using &lt;code&gt;brew install cocoapods&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Easy, right? Just make sure your web app is responsive and it should just work smoothly. 🚀 Good luck, mates!&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>ios</category>
      <category>android</category>
      <category>javascript</category>
    </item>
    <item>
      <title>2 ways of making your form inputs accessible</title>
      <dc:creator>SonicDev</dc:creator>
      <pubDate>Wed, 07 Jul 2021 06:36:34 +0000</pubDate>
      <link>https://dev.to/jacobporci/2-ways-of-making-your-input-accessible-4mg</link>
      <guid>https://dev.to/jacobporci/2-ways-of-making-your-input-accessible-4mg</guid>
      <description>&lt;p&gt;Recently, my team has been working on accessibility for testing. And we've had problems with getting our input elements to be following the principles of the &lt;a href="https://testing-library.com" rel="noopener noreferrer"&gt;testing-library&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As per the &lt;a href="https://testing-library.com/docs/queries/about/" rel="noopener noreferrer"&gt;priority&lt;/a&gt; in the docs, we should be using &lt;code&gt;getByRole&lt;/code&gt; most often for the test to resemble how the user interacts with it in the browser. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// get the textbox that has the label of 'Bar'&lt;/span&gt;
&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;textbox&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bar&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So for us to use &lt;code&gt;getByRole&lt;/code&gt;, we should make sure that the &lt;code&gt;&amp;lt;input /&amp;gt;&lt;/code&gt; is related to the &lt;code&gt;&amp;lt;label /&amp;gt;&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;There are 2 ways we can do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt; &lt;span class="nx"&gt;htmlFor&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;foo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Bar&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/label&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;foo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Bar&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/label&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way, we can make sure that our form elements are accessible, not only by the user but also by our tests.&lt;/p&gt;

&lt;p&gt;Cheers! ☕ 🍺&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>react</category>
    </item>
    <item>
      <title>Testing an accessible UI</title>
      <dc:creator>SonicDev</dc:creator>
      <pubDate>Tue, 29 Jun 2021 10:56:14 +0000</pubDate>
      <link>https://dev.to/jacobporci/testing-an-accessible-ui-51nk</link>
      <guid>https://dev.to/jacobporci/testing-an-accessible-ui-51nk</guid>
      <description>&lt;p&gt;Recently, my team has been writing lots of &lt;a href="https://www.cypress.io/" rel="noopener noreferrer"&gt;Cypress&lt;/a&gt; tests before releasing a feature. And it struck us that while we were pushing on using &lt;a href="https://testing-library.com/" rel="noopener noreferrer"&gt;testing library&lt;/a&gt; for both &lt;strong&gt;Cypress&lt;/strong&gt; and &lt;strong&gt;ReactJS&lt;/strong&gt;, we forgot something, and that is &lt;strong&gt;ACCESSIBILITY&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So let me give an example code of a simple UI component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;TextField&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Foo&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/label&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we were using &lt;strong&gt;Enzyme&lt;/strong&gt;, the test would be something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should display correct value after typing in something&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;wrapper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;shallow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Textfield&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;wrapper&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;simulate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;change&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not bad right? It looks okay, but it's not how I see the user will interact with it in the browser, because we are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;just finding a random HTML input tag&lt;/li&gt;
&lt;li&gt;simulating an HTML event&lt;/li&gt;
&lt;li&gt;checking the property &lt;em&gt;value&lt;/em&gt; of an HTML input tag.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, maybe I'm just not that familiar on proper use of Enzyme. But once I've used testing-library/react, it changed my way of thinking in testing UI components.&lt;/p&gt;

&lt;p&gt;If we were to change the Textfield component and make it more accessible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;TextField&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt; &lt;span class="nx"&gt;htmlFor&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;foo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Foo&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/label&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;foo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We set a relationship between the &lt;code&gt;label&lt;/code&gt; and the &lt;code&gt;input&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Using &lt;code&gt;testing-library/react&lt;/code&gt;, we can come up with this test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should display correct value after typing in something&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// render in browser&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Textfield&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// Using the label here as the name of the input field&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;screen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByLabelText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Foo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// simulate the user typing 'Bar'&lt;/span&gt;
  &lt;span class="nx"&gt;userEvent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bar&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// Check that the input with the label 'Foo' has a value of 'Bar'&lt;/span&gt;
  &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toHaveValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bar&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// we can also check if this is really the value displayed in the browser&lt;/span&gt;
  &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;screen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByDisplayValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bar&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;toBeInTheDocument&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are guided by the &lt;a href="https://testing-library.com/docs/guiding-principles" rel="noopener noreferrer"&gt;guiding principle&lt;/a&gt; of &lt;strong&gt;Testing Library&lt;/strong&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The more your tests resemble the way your software is used, the more confidence they can give you.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In conclusion, by thinking how the user would interact with a UI component in the browser, we can imagine how we would write our tests, at the same time, we can also increase the accessibility of our UI components.&lt;/p&gt;

&lt;p&gt;🍻 Cheers and Happy Testing! 🛠️&lt;/p&gt;

</description>
      <category>react</category>
      <category>testing</category>
      <category>javascript</category>
      <category>a11y</category>
    </item>
    <item>
      <title>M1 Macbook Air after 1 month of development</title>
      <dc:creator>SonicDev</dc:creator>
      <pubDate>Tue, 09 Feb 2021 13:08:37 +0000</pubDate>
      <link>https://dev.to/jacobporci/m1-macbook-air-after-1-month-of-development-19lo</link>
      <guid>https://dev.to/jacobporci/m1-macbook-air-after-1-month-of-development-19lo</guid>
      <description>&lt;p&gt;After years of dreaming of buying the perfect laptop, I finally bought it, the new &lt;em&gt;M1 Macbook Air&lt;/em&gt;(512GB SSD and 8GB RAM version). Great build, good keyboard, no fans(yet no thermal issues), fast, light, great screen, good speakers, and a &lt;strong&gt;battery that lasts a day&lt;/strong&gt;. So far, everything about it was good.&lt;/p&gt;

&lt;p&gt;I was hesitant to buy this machine because I was worried that running my development software on &lt;strong&gt;Rosetta 2&lt;/strong&gt;(non-native &lt;em&gt;ARM&lt;/em&gt;) would hinder the performance. But I was amazed by how fast this machine is. Everything ran smoothly, and installations were like nothing even changed with the &lt;em&gt;Mac&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;The first and only time it had a hiccup on me was performance testing the Table component I created. I haven't implemented any optimizations on my table. So I tried displaying &lt;strong&gt;5,000&lt;/strong&gt; rows in 1 go, and I've noticed some slowdowns when switching windows. I was curious if this was also present in my work laptop, a &lt;em&gt;10th gen Intel MacBook Pro&lt;/em&gt; with 16GB RAM. So I tried and did the same thing with it. It looks like it's only a bit faster(ahead by 2-3 seconds on the initial render of rows).&lt;/p&gt;

&lt;p&gt;In my conclusion, I think it is an excellent machine. I think you won't need to upgrade any time soon if you buy any &lt;strong&gt;Apple Silicon&lt;/strong&gt; powered Mac. It competes with the &lt;em&gt;last-gen Macbook&lt;/em&gt; with higher specs, and if not always, faster. My &lt;em&gt;M1 Macbook Air&lt;/em&gt; is a &lt;strong&gt;fanless&lt;/strong&gt; machine that is not even hot to the touch than my Intel MacBook that is &lt;strong&gt;ALWAYS&lt;/strong&gt; hot to the touch, and fans are always ramping up to the max. This is probably the best bang for buck machine for any developer.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>node</category>
    </item>
  </channel>
</rss>
