<?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: Ben Mitchinson</title>
    <description>The latest articles on DEV Community by Ben Mitchinson (@bmitchinson).</description>
    <link>https://dev.to/bmitchinson</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%2F205356%2F2e6eb2f3-8749-48e0-a878-d8abdd1f11e7.jpeg</url>
      <title>DEV Community: Ben Mitchinson</title>
      <link>https://dev.to/bmitchinson</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bmitchinson"/>
    <language>en</language>
    <item>
      <title>Mocking classes in Jest / Typescript</title>
      <dc:creator>Ben Mitchinson</dc:creator>
      <pubDate>Mon, 18 Oct 2021 02:09:27 +0000</pubDate>
      <link>https://dev.to/bmitchinson/mocking-classes-in-jest-typescript-2pc</link>
      <guid>https://dev.to/bmitchinson/mocking-classes-in-jest-typescript-2pc</guid>
      <description>&lt;p&gt;&lt;em&gt;Cross posted on my website &lt;a href="https://mitchinson.dev/jest-typescript-mocks"&gt;mitchinson.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  TL;DR
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/bmitchinson/ts-node-starter/blob/main/src/GetANumber.test.ts"&gt;Example Test&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GetANumber.test.ts mocks a class, and further customizes a class method on that mocked class for a single test.&lt;/p&gt;

&lt;h3&gt;
  
  
  Purpose
&lt;/h3&gt;

&lt;p&gt;It was surprisingly hard to find a recently written article about the fastest way to setup Jest with some simple class mocks in Typescript. The following example demonstrates mocking a class and modifying methods of that mocked class within a single test.&lt;/p&gt;

&lt;p&gt;Libraries like jest-ts-auto-mock are not used, cause I was unable to find a way to get them to work. Could have just been using them wrong but who knows.&lt;/p&gt;

&lt;p&gt;I used the following methods to mock classes in an Express app while coding in test driven development.&lt;/p&gt;

&lt;h3&gt;
  
  
  Explanation
&lt;/h3&gt;

&lt;p&gt;Comments are all over in this &lt;a href="https://github.com/bmitchinson/ts-node-starter"&gt;Example Repo&lt;/a&gt;, but some highlights are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;jest.mock&lt;/code&gt; ends up at the top of the file when it's transpiled.

&lt;ul&gt;
&lt;li&gt;Even if you put it under other things, it gets pulled to the top.
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;///////////////////&lt;/span&gt;
&lt;span class="nx"&gt;jest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./Class&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mockOne&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;does a thing&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="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;one&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;does another thing&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="nx"&gt;jest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./Class&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mockTwo&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;two&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="c1"&gt;///////////////////&lt;/span&gt;

&lt;span class="c1"&gt;// is really&lt;/span&gt;

&lt;span class="c1"&gt;///////////////////&lt;/span&gt;
&lt;span class="nx"&gt;jest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./Class&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mockOne&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// this mock is useless&lt;/span&gt;
&lt;span class="nx"&gt;jest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./Class&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mockTwo&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// as it's immediately replaced&lt;/span&gt;

&lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;does a thing&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="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;one&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;does another thing&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="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;two&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="c1"&gt;///////////////////&lt;/span&gt;

&lt;span class="c1"&gt;// You might as well always write `.mock` calls at the top of your file.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The example mocks a class that's a default export. Named exports can also be mocked by nesting the class mockImplementation one layer deeper.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;jest.mock('{path_to_custom_class}')&lt;/code&gt; will replace that paths default export in the runtime with the defined mock in &lt;code&gt;__mocks__&lt;/code&gt; dir defined at the same level.&lt;/li&gt;
&lt;li&gt;If you'd like to modify a mock / assert things that happened to a mock, you need to import them from the "real" class.

&lt;ul&gt;
&lt;li&gt;Never manually import from &lt;code&gt;__mocks__&lt;/code&gt;, get the exports of &lt;code&gt;__mocks__&lt;/code&gt; "through" a normal import.
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;MockNumberGen&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./__mocks__/NumberGen&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;NumberGen&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./NumberGen&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// __mocks__/CVEPathData&lt;/span&gt;

&lt;span class="c1"&gt;// Give me the mock class i've defined in __mocks__/{classname} and let me&lt;/span&gt;
&lt;span class="c1"&gt;//    name it mock{ClassName}Constructor&lt;/span&gt;
&lt;span class="c1"&gt;// Give me the mock function i've defined in __mocks__/{classname}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mockNumberGenConstructor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mockGetOne&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="c1"&gt;// Get these things from the NumberGen class, because I know that jest&lt;/span&gt;
  &lt;span class="c1"&gt;//     has secretly replaced it with the contents of MockNumberGen&lt;/span&gt;
  &lt;span class="nx"&gt;NumberGen&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;unknown&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;MockNumberGen&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Tell typescript that these things are really coming from MockNumberGen,&lt;/span&gt;
&lt;span class="c1"&gt;//     so it should type them as such&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The full test is &lt;a href="https://github.com/bmitchinson/ts-node-starter/blob/main/src/GetANumber.test.ts"&gt;available here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>jest</category>
      <category>tutorial</category>
      <category>mock</category>
    </item>
    <item>
      <title>Accenture - August + September 2021</title>
      <dc:creator>Ben Mitchinson</dc:creator>
      <pubDate>Sun, 17 Oct 2021 23:51:11 +0000</pubDate>
      <link>https://dev.to/bmitchinson/accenture-august-september-2021-10an</link>
      <guid>https://dev.to/bmitchinson/accenture-august-september-2021-10an</guid>
      <description>&lt;p&gt;&lt;em&gt;Cross posted on &lt;a href="https://mitchinson.dev/pillar/august-september-21/"&gt;my website&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I've worked on
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Created dozens of tickets coinciding with new 2 project kick-offs.

&lt;ul&gt;
&lt;li&gt;Feels good to organize a fresh Zenhub project board with clear acceptance criteria / patterns for completing and discussing spikes / making goals clear and accessible to the team.&lt;/li&gt;
&lt;li&gt;Team members expressed that they enjoyed getting to work on the initiatives because the work was made so clear.&lt;/li&gt;
&lt;li&gt;Velocity on these new projects is high 📈&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Deployed a suite of data ingestion microservices to Azure with Helm, k8s, and Terraform&lt;/li&gt;
&lt;li&gt;Setup Github actions to do static code analysis, image publication, and deployment with Terraform.&lt;/li&gt;
&lt;li&gt;Setup boilerplate for a Typescript Express API with CI/CD, Linting, automatic increased VSCode support, and Jest class mocking structures / patterns&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I'd like to improve
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Code Reviews
&lt;/h4&gt;

&lt;p&gt;I've read the &lt;a href="https://google.github.io/eng-practices/review/"&gt;google eng practices&lt;/a&gt; dozens of times now. I feel like when I start a review I ask myself different questions every time, leaving me with reviews I don't feel super confident in, that are inconsistent in depth. Would like to start documenting questions I ask myself when beginning a review.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Accenture - June + July 2021</title>
      <dc:creator>Ben Mitchinson</dc:creator>
      <pubDate>Sun, 01 Aug 2021 23:23:32 +0000</pubDate>
      <link>https://dev.to/bmitchinson/accenture-june-july-2021-2957</link>
      <guid>https://dev.to/bmitchinson/accenture-june-july-2021-2957</guid>
      <description>&lt;p&gt;&lt;em&gt;Cross posted on &lt;a href="https://mitchinson.dev/pillar/june-july-21/"&gt;mitchinson.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What I've been doing at &lt;a href="https://www.accenture.com/us-en/insights/industry-x-index"&gt;Accenture&lt;/a&gt; for the month of June + July.&lt;/p&gt;

&lt;p&gt;Took a break in between jobs during the month of May. Did some contracting to deploy a small node server + corresponding frontend in AWS Beanstalk.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I've worked on
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Managed deployments in multiple AWS k9s environments with Terraform&lt;/li&gt;
&lt;li&gt;Introduction to elixir&lt;/li&gt;
&lt;li&gt;Learning how to work in an &lt;a href="https://github.com/Datastillery"&gt;open source organization&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Presented on code review standards + practices&lt;/li&gt;
&lt;li&gt;Utilized the Helm Terraform provider to manage helm deployments in k9s&lt;/li&gt;
&lt;li&gt;Configured Strimzi to deploy a kafka cluster&lt;/li&gt;
&lt;li&gt;Pair Programming in a remote environment. We typically pair for 4+ hours a day.&lt;/li&gt;
&lt;li&gt;Deploying Prometheus and Grafana alongside our data pipeline using public helm charts&lt;/li&gt;
&lt;li&gt;Combining several of our teams custom helm charts into one configurable mono chart&lt;/li&gt;
&lt;li&gt;Coming up with fun + not awkward bonding activities for our team to participate in despite our distance from one another&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I'd like to improve
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Learning so much technology has left me feeling burnt out when I could be taking on new cards / tech debt. I'd like to more effectively use my time when not actively pairing.&lt;/li&gt;
&lt;li&gt;Making new cards when discovering potential improvements&lt;/li&gt;
&lt;li&gt;Continue to practice creating very organized and condensed technical presentations&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Vail Systems - March + April 2021</title>
      <dc:creator>Ben Mitchinson</dc:creator>
      <pubDate>Wed, 05 May 2021 16:25:42 +0000</pubDate>
      <link>https://dev.to/bmitchinson/vail-systems-march-april-2021-1i86</link>
      <guid>https://dev.to/bmitchinson/vail-systems-march-april-2021-1i86</guid>
      <description>&lt;p&gt;&lt;em&gt;Cross posted on &lt;a href="https://mitchinson.dev/vail-march-april-2021/"&gt;mitchinson.dev&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What I've been doing at &lt;a href="https://www.vailsys.com/"&gt;Vail Systems&lt;/a&gt; for March + April.&lt;/p&gt;

&lt;p&gt;Writing for both March and April in this post, so it's a bit longer. I spent much of the last month getting ready for a new Software Engineering position at Pillar Technologies in Des Monies, as well as working through the loss of a family member. My start date at Pillar is May 19th, and I can't wait to begin.&lt;/p&gt;

&lt;p&gt;Currently I'm taking time off to relax + travel, as well as to do some contracting for a friend's business.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I've worked on (Technical)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Using &lt;code&gt;ffmpeg-fluent&lt;/code&gt; and ffmpeg to convert user-uploaded audio to universal formats. How to convert and manage codecs and conversion&lt;/li&gt;
&lt;li&gt;Updating our application to support uploaded audio in addition to in-app generated audio. (Database -&amp;gt; GraphQL -&amp;gt; Client)&lt;/li&gt;
&lt;li&gt;Using PlantUML as a way to communicate abstract ideas concretely, and iterate on design in a traditional code-based merge request process&lt;/li&gt;
&lt;li&gt;Learning how to negotiate salaries, and how to respectfully exit a company&lt;/li&gt;
&lt;li&gt;Presented on how to organize GraphQL schema inside a NestJS based application&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Let GraphQL abstract the Database
&lt;/h4&gt;

&lt;p&gt;Often my impulse is to have an app's GraphQL schema mirror the database 1:1. Recently, we added a new database table, and it made much more sense to instead abstract under an existing GraphQL type.&lt;/p&gt;

&lt;p&gt;It allowed for flexibility since the resolver now would pull data from more than one database source. It helped me realize that unless you're willing to make constant changes to your schema each time the database is altered, having your schema align 1:1 with your database makes you miss out on the abstraction opportunities offered by GraphQL.&lt;/p&gt;

&lt;p&gt;I think we could have promoted this idea by only resolving the fields that were in use on the client. We had resolvers that resolved every field of a table, even if it wasn't in use client-side. If instead, we only added fields when the need on client arose, we'd have a much slimmer + more readable GraphQL schema, and it'd be less tempting to make every database field available by default.&lt;/p&gt;

&lt;h4&gt;
  
  
  Using type predicates
&lt;/h4&gt;

&lt;p&gt;Type Predicates are cool! Our resolver was handling two possible interfaces, and it was nice to find a type-safe way to handle either interface. Earlier in my career I would have resorted to &lt;code&gt;any&lt;/code&gt; so it's exciting to start reaching further to see how TypeScript can help. I'd like to take an advanced TypeScript course sometime soon.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates"&gt;Using Type Predicates&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Sometimes you can break tests
&lt;/h4&gt;

&lt;p&gt;One sprint I was working on a ticket, and when I finished the AC, some existing tests broke. These broke because the ticket was part of a large new feature, and without the remaining tickets completed, tests were going to stay broken.&lt;/p&gt;

&lt;p&gt;I assumed "don't let tests break", and took on two more tickets simultaneously, in an effort to implement all of the features necessary to make tests green.&lt;/p&gt;

&lt;p&gt;In retrospect, I don't think this was the way to go. In the event you're merging to a feature branch and not mainline code, I think it might be okay to break tests.&lt;/p&gt;

&lt;p&gt;If it's documented (&lt;code&gt;// will be green in TTPSP-189&lt;/code&gt;), I think letting them fail will help code review stay small + keep the team moving faster. The expectation remains that these tests will be green before reaching mainline code, so if this&lt;br&gt;
happens again, I'd like to bring it up to my team to see what they think of the approach.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I've Learned (Personal)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Working from home -&amp;gt; move around the house
&lt;/h4&gt;

&lt;p&gt;While I like my desk setup, I find I'm most productive when I move around the house. Room, living room couch, kitchen table. Moving around has helped my brain stay a lot more focused.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why is the house a mess
&lt;/h4&gt;

&lt;p&gt;After a day of work, I'd look at the kitchen or my room and think "why is it such a mess here", and start feeling pretty down. I was home all day, I really didn't have time to clean? I was home all day, yet there's nothing ready for&lt;br&gt;
dinner?&lt;/p&gt;

&lt;p&gt;I was at work! Of course the house is a mess, I haven't been "home", I've been at "work". Reminding myself of that line has helped me feel better when I end work for the day. Still looking forward to being at an office soon to have a&lt;br&gt;
physical representation of that line.&lt;/p&gt;

&lt;h4&gt;
  
  
  Realistic estimates, not best case
&lt;/h4&gt;

&lt;p&gt;It can be tempting for me to give "best case estimates" during standups as a way to push myself to get something done as quickly as possible. I'd like to find other ways to motivate myself that don't result in flakey estimations from my team's perspective.&lt;/p&gt;

&lt;p&gt;Going forward I'd like to practice giving more likely estimates and working to complete them a bit sooner than originally expected, instead of finishing right down to the wire or late.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd like to improve
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Creating tickets for experimentation efforts
&lt;/h4&gt;

&lt;p&gt;I'm privileged to be on a team where we're able to take time and experiment with new ideas. I've found that I sometimes give myself too many things to juggle: improving a Jenkins step, adding a new cypress improvement, experimenting with a new build tool. It became difficult to track all of these initiatives. I'd like to ticket ideas for refactors / features and make sure to note why I find them valuable. Then it'd be a bit more motivating to return to existing ideas during free time, instead of endlessly creating new ideas, and never completing any.&lt;/p&gt;

&lt;h4&gt;
  
  
  26 files changed, pump the breaks.
&lt;/h4&gt;

&lt;p&gt;That's an indication that you might need to slow down and reassess your design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources found / Articles I liked:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.emgoto.com/react-bundles-and-code-splitting/"&gt;React Bundles and Code Splitting - Emma Goto&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates"&gt;Using type predicates&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.planttext.com/"&gt;Capable + Fast UML&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Vail Systems - Feb 2021</title>
      <dc:creator>Ben Mitchinson</dc:creator>
      <pubDate>Sun, 07 Mar 2021 02:53:54 +0000</pubDate>
      <link>https://dev.to/bmitchinson/vail-systems-feb-2021-4kbl</link>
      <guid>https://dev.to/bmitchinson/vail-systems-feb-2021-4kbl</guid>
      <description>&lt;p&gt;&lt;em&gt;Cross posted on &lt;a href="https://mitchinson.dev/vail-feb-2021"&gt;my website&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What I've been doing at &lt;a href="https://www.vailsys.com/"&gt;Vail Systems&lt;/a&gt; for the month of February.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I've worked on
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Custom theming: Account specific client theming in Material UI&lt;/li&gt;
&lt;li&gt;Custom terminology in AWS Translate&lt;/li&gt;
&lt;li&gt;Using Kibana to create dashboards with KQL to analyze API performance.&lt;/li&gt;
&lt;li&gt;Using Nock with Cucumber to programmatically mock external calls&lt;/li&gt;
&lt;li&gt;Started learning about the advantages of Snowpack and ESModules&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I've Learned (Technical)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Mocking external API calls
&lt;/h4&gt;

&lt;p&gt;Nock is a great library, but I'm looking forward to&lt;br&gt;
&lt;a href="https://github.com/mswjs/msw"&gt;MSW&lt;/a&gt; growing. I'd be curious how they handle node API mocking + recording. I don't think Nock is as full of a replacement of VCR for ruby.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I've Learned (Personal)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Break down problems into a confined example
&lt;/h4&gt;

&lt;p&gt;We had an issue using decorators with nestjs modules, and in order to ask for help, I made a smaller reproducible example of the issue. This ended up being a sort of "rubber duck", and helped me arrive at the solution myself. I'd like to continue approaching problems with this style.&lt;/p&gt;

&lt;h4&gt;
  
  
  Company Technology Channels
&lt;/h4&gt;

&lt;p&gt;Being distributed, it's hard to have conversations about specific software and tooling when I'm not sure who to talk to. I'd like to help implement specific channels dedicated to specific tools. a "cypress" channel and a "rust" channel, anything anyone can think of. This way devs can pick and choose what to be a part of, and share knowledge across teams. I suggested this and will be following up to see if there's anything I can do to help.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd like to improve (Technical)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  sorry-cypress
&lt;/h4&gt;

&lt;p&gt;I want to investigate using &lt;code&gt;sorry-cypress&lt;/code&gt; for better metrics + parallelization in our k8s setup. The developer experience of cypress is fantastic, but our build time is reaching an average of 30 minutes 😔&lt;/p&gt;

&lt;h4&gt;
  
  
  Stop reading + start trying
&lt;/h4&gt;

&lt;p&gt;Often I'm reading about new tools / figuring out how something could work, but not as often do I add the dependency to a throwaway branch and experiment. I'd feel a lot more confident breaking down new technical challenges if I had previously experimented more.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd like to improve (Personal)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Write as you learn
&lt;/h4&gt;

&lt;p&gt;I hoped to put up two smaller blog posts about some TS examples I found interesting and wanted to share, but I can't remember half of what I wanted to note down now that it's been a few weeks. Going forward I'd like to a small technical post as I'm finishing it up.&lt;/p&gt;

&lt;h4&gt;
  
  
  Pace yourself (Pomodoro)
&lt;/h4&gt;

&lt;p&gt;I find myself working intensely for hours, and feeling burnt out toward the end of the day. I'd like to work on restricting myself to blocks of time so that I still have the energy to take on new things at the end of the day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources found / Articles I liked:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.snowpack.dev/tutorials/react"&gt;https://www.snowpack.dev/tutorials/react&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/dan_abramov/status/1368277175598735366?s=20"&gt;https://twitter.com/dan_abramov/status/1368277175598735366?s=20&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Posts of Mine
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Accessing private values of a class within a method decorator
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://repl.it/@bmitchinson/decorator#index.ts"&gt;https://repl.it/@bmitchinson/decorator#index.ts&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vail</category>
      <category>remote</category>
      <category>blog</category>
    </item>
    <item>
      <title>6 Months at Vail Systems</title>
      <dc:creator>Ben Mitchinson</dc:creator>
      <pubDate>Tue, 16 Feb 2021 01:30:12 +0000</pubDate>
      <link>https://dev.to/bmitchinson/6-months-at-vail-systems-1ilj</link>
      <guid>https://dev.to/bmitchinson/6-months-at-vail-systems-1ilj</guid>
      <description>&lt;p&gt;&lt;em&gt;Cross posted from &lt;a href="http://mitchinson.dev/Vail-2020/"&gt;http://mitchinson.dev/Vail-2020/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In June of 2020, I started as a full-time Web Software Engineer at &lt;a href="https://www.vailsys.com/"&gt;Vail Systems&lt;/a&gt;. Here are highlights of what I've learned, and what I'll be working on going forward. The plan is to do one of these a month as quick bullet points, starting in March.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I've worked on
&lt;/h2&gt;

&lt;p&gt;Our team of 5 made a full-stack app for translating text and generating corresponding audio. Large quantities of text are imported inside CSVs and then edited further inside the client React app. A NestJS API then resolves translations and audio generation with AWS services, stores resulting audio in S3, and maintains transaction data in a Vail MSSQL database.&lt;/p&gt;

&lt;h4&gt;
  
  
  Technology used:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;React (CRA) / Yarn&lt;/li&gt;
&lt;li&gt;Typescript (monorepo shared typings)&lt;/li&gt;
&lt;li&gt;Node / NestJS / GraphQL&lt;/li&gt;
&lt;li&gt;Cypress / react-testing-library&lt;/li&gt;
&lt;li&gt;Nock / CucumberJS&lt;/li&gt;
&lt;li&gt;DataGrip + KnexJS&lt;/li&gt;
&lt;li&gt;Jenkins + k8s&lt;/li&gt;
&lt;li&gt;Docusaurus&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I've Learned (Technical)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Make TDD work for you
&lt;/h4&gt;

&lt;p&gt;I've found that TDD is intimidating for some developers, especially in client-side testing. I used to think that to do TDD, I had to have every single assertion down ahead of time. That's not the case. Just make a test case with a proper title, and if you're stuck, write out assertions in a comment:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// when clicked, the button will turn blue&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Don't let assertions distract you from the purpose of TDD: to have a clear achievable goal while coding + making decisions. You can still fulfill that purpose without syntax perfect assertions. After writing enough tests, assertions will come more naturally.&lt;/p&gt;

&lt;h4&gt;
  
  
  Starting an app from scratch
&lt;/h4&gt;

&lt;p&gt;I've been fortunate to start working on a product from its start and it's taught me more than I can write here, but some days I wasted time by trying to add as many new + exciting tools as possible. After focusing on core framework functionality and less added tooling, we were able to K.I.S.S (keep it simple stupid 💋). Now, we have many more options and choices for what we'd like to add when implementing new features because we're not limited by 1000x external dependencies. Shout-out to my team lead Nav for helping set those restraints.&lt;/p&gt;

&lt;h4&gt;
  
  
  Jenkins + Docker
&lt;/h4&gt;

&lt;p&gt;Maintaining / configuring a mono repo in Jenkins with dynamic tests for linting, component + integration at both the UI and API layers, and e2e.&lt;/p&gt;

&lt;h4&gt;
  
  
  Auth
&lt;/h4&gt;

&lt;p&gt;We implemented auth several times looking for a technology we liked. Was good to understand why auth solutions work the way they do and what they protect against (XXS, HttpOnly, Secure, Localstorage vs cookies, etc...), as opposed to just how to configure PassportJS.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I've Learned (Personal)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Pairing remote
&lt;/h4&gt;

&lt;p&gt;It's been good to practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;giving a pairing partner space to consider a problem while on a call. It's easy to accidentally interrupt.&lt;/li&gt;
&lt;li&gt;Working off a shared to-do list helps keep efforts focused when new ideas pop.&lt;/li&gt;
&lt;li&gt;Gathering resources / searching online to help solve a problem, while someone is actively working on it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Work balance while working from home
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;How to take a 30-minute mind break to prepare something for dinner, without it derailing your entire afternoon.&lt;/li&gt;
&lt;li&gt;Taking breaks away from screens. Video games aren't the best break for the mind or the eyes.&lt;/li&gt;
&lt;li&gt;How to work async: Send updates + check in on others. Grateful that my teammates are always up for a call / question.&lt;/li&gt;
&lt;li&gt;Creating a work environment: Move your desk into a space dedicated for 9-5 and change the scenery every once and a while.&lt;/li&gt;
&lt;li&gt;Communicate with others when struggling! It's easy to forget you're not in it alone.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Taking notes
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;When someone says "how do we do that again", it feels great to fire off a document / confluence page with a breakdown + meeting summary. Meetings become 2x as valuable when an artifact exists afterward, &lt;em&gt;especially&lt;/em&gt; in a remote setting. I'm a big fan of docs and making creating documentation part of the development process.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I'd like to improve (Technical)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Client-side performance metrics (web.dev)
&lt;/h4&gt;

&lt;p&gt;We don't have metrics for many of our operations. I'd like to find ways to incorporate things like "time to interactive" and "first paint" in our test suite so that we can find regressions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Nock
&lt;/h4&gt;

&lt;p&gt;Some of our tests interact with AWS and cause conflicts when running tests on multiple branches. I'd like to work on understanding "Nock" and using it to replace AWS calls.&lt;/p&gt;

&lt;h4&gt;
  
  
  Docs
&lt;/h4&gt;

&lt;p&gt;Areas of our app like authentication and simple things like our implementation of recaptcha would benefit strongly from a docs page. I'd like to practice writing things up on new features as they're being implemented. Instead of trying to force myself to do them after they've been completed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd like to improve (Personal)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Following through on new ideas + making tickets
&lt;/h4&gt;

&lt;p&gt;Often I think "oh we could improve X by doing Y" or "Hmmm X seems like it's performing strangely". If those ideas aren't related to the task at hand, it's easy for me to throw them to the wayside. I'd like to build a better habit of making actionable tickets for those thoughts, or at the bare minimum, noting them down.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources found / Articles I liked:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Atlassian on Remote Work research findings - &lt;a href="https://www.atlassian.com/blog/teamwork/new-research-covid-19-remote-work-impact"&gt;link&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vail</category>
      <category>remote</category>
      <category>blog</category>
    </item>
    <item>
      <title>If it ain't broke</title>
      <dc:creator>Ben Mitchinson</dc:creator>
      <pubDate>Sat, 24 Oct 2020 04:47:01 +0000</pubDate>
      <link>https://dev.to/bmitchinson/if-it-ain-t-broke-5d9n</link>
      <guid>https://dev.to/bmitchinson/if-it-ain-t-broke-5d9n</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally posted on &lt;a href="https://mitchinson.dev/If-It-Aint-Broke/"&gt;https://mitchinson.dev/If-It-Aint-Broke/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I haven't updated my website site in too long, and this post is somewhat of a resolution.&lt;/p&gt;



&lt;h3&gt;
  
  
  If it ain't broke don't fix it
&lt;/h3&gt;




&lt;ul&gt;
&lt;li&gt;Is the javascript bundle of my portfolio / blog website &lt;a href="https://mitchinson.dev"&gt;https://mitchinson.dev&lt;/a&gt; larger than it needs to be? Probably.&lt;/li&gt;
&lt;li&gt;Am I using google analytics instead of the more ethical &lt;a href="https://plausible.io/open-source-website-analytics"&gt;Plausible&lt;/a&gt;, yeah.&lt;/li&gt;
&lt;li&gt;Should future static sites of mine be written in something cool lightweight and new like e11nty, maybe.&lt;/li&gt;
&lt;li&gt;Is my lighthouse score 110%, no. (&lt;a href="https://lighthouse-dot-webdotdevsite.appspot.com//lh/html?url=https%3A%2F%2Fmitchinson.dev"&gt;It's not toooo gross tho&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br&gt;
For the last view months during covid, I've had a ton of ideas. Fun things I could make / try. But at the front of my mind I say&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"But first I should redo my website"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;br&gt;
The purpose of my website is for me to be able to post projects I'm proud of and track tech related goals.&lt;/p&gt;

&lt;p&gt;Whether the site is fully optimized to Rich Harris standards or not, it gets the job done, and it gets it done well.&lt;/p&gt;



&lt;p&gt;While twitter is great for learning about new tools, it can be easy to be bogged&lt;br&gt;
down into an endless cycle of "you should checkout and use this neat new thing".&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;If you attempt to use every tool designed to make launching a product "easier" and "efficiently", you'll never launch a product.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;Now that the barrier of "redoing my website" has been solved with instead 50 lines of markdown, I'm looking forward to smaller more frequent posts. Hopefully hints that others can find valuable about KnexJS, GraphQL, NestJS, React and more.&lt;/p&gt;

&lt;p&gt;I'm currently learning rust basics outside of work, to &lt;a href="https://www.notion.so/bmitchinson/JPGVR-Viewer-5136ef4d51744e73936bb9b1b549b246"&gt;work on this VR project&lt;/a&gt;, and i'd love to know what you think of it.&lt;/p&gt;

&lt;p&gt;Stay safe, wear a mask, and please vote.&lt;/p&gt;

</description>
      <category>personal</category>
      <category>blog</category>
      <category>advice</category>
    </item>
    <item>
      <title>Trying Lazy Loading and getting flicker?</title>
      <dc:creator>Ben Mitchinson</dc:creator>
      <pubDate>Tue, 26 May 2020 02:26:55 +0000</pubDate>
      <link>https://dev.to/bmitchinson/beginner-using-lazy-loading-getting-flicker-1148</link>
      <guid>https://dev.to/bmitchinson/beginner-using-lazy-loading-getting-flicker-1148</guid>
      <description>&lt;p&gt;Hey ya'll! Using suspense + lazy for the first time, would really really appreciate some help.&lt;/p&gt;

&lt;p&gt;I've recently enabled suspense and lazy loading in my application, and when I apply them to my &lt;code&gt;&amp;lt;Router&amp;gt;&lt;/code&gt;, I get a solid load + performance boost.&lt;/p&gt;

&lt;p&gt;Was wondering though, in-between clicking on pages, I get this huge white flicker. I'm using it like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Suspense, lazy } from 'react';
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
{...}

const NotFound = lazy(() =&amp;gt; import('./components/NotFound'));
const Feed = lazy(() =&amp;gt; import('./components/Feed'));
const Food = lazy(() =&amp;gt; import('./components/Food'));
{...}
import('./components/DEBUGEasyPeasyContents'));

const App: React.SFC = () =&amp;gt; {
    const isLoggedIn = useStoreState(state =&amp;gt; state.userModel.isLoggedIn);

    const Spinner = &amp;lt;Spin size="large" style={{ width: '100%', margin: 'auto', padding: '10%' }} /&amp;gt;;

    return (
        &amp;lt;&amp;gt;
            &amp;lt;ReactNotification /&amp;gt;
            &amp;lt;Router&amp;gt;
                &amp;lt;Suspense fallback={wrapHOC(Spinner)}&amp;gt;
                    &amp;lt;Switch&amp;gt;
                        {isLoggedIn &amp;amp;&amp;amp; (
                            &amp;lt;&amp;gt;
                                &amp;lt;Route path="/login" exact={true} component={Login} /&amp;gt;
                                &amp;lt;Route path="/changePassword" exact={true} component={wrapHOC(ChangePassword)} /&amp;gt;
                                &amp;lt;Route path="/account" exact={true} component={wrapHOC(AccountInfo)} /&amp;gt;
                                &amp;lt;Route path="/dashboard" exact={true} component={wrapHOC(Dashboard)} /&amp;gt;
                            {...}
                    &amp;lt;/Switch&amp;gt;
                &amp;lt;/Suspense&amp;gt;
            &amp;lt;/Router&amp;gt;
        &amp;lt;/&amp;gt;
    );
};

export default App;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In-between clicking on pages, the whole page flashes white for like 1.3ms according to the chrome screenshot inspector. It ruins the performance boost for me, so I'm desperate to figure out the cause.&lt;/p&gt;

&lt;p&gt;Any advice appreciated, thanks!&lt;/p&gt;

</description>
      <category>help</category>
      <category>react</category>
    </item>
  </channel>
</rss>
