Photo by Timothy Dykes on Unsplash

Summary

In our frontend application, we make use of components that subscribe to context providers, and those providers often contain state-updating logic. Test setup for context-wrapped components is often confusing, and quite frankly, a pain.

There are two main options for testing these context-wrapped components:

  1. Use your custom context provider, allowing the component under test to trigger any logic contained in the provider.

Basics of React Context

Before we jump into testing, let’s review some key attributes of React Context…


Photo by Marc Najera on Unsplash

I recently went down a rabbit hole with a coworker, asking ourselves, “What is the difference between a map and a keyword list?” We knew that they both provide the similar seeming capabilities to store and access key-value information but were unsure of the underlying differences.

Consulting the docs on the Keyword module didn’t immediately clear this up for us:

“A keyword may have duplicated keys so it is not strictly a key-value data type. …


Photo by Brook Anderson on Unsplash

At Fast Radius, we’re building responsive and performant applications in Elixir + Phoenix and React. We’ve leveraged Phoenix channels to help improve our UX.

What are channels?

Channels are a way to send messages in real time between server and client over a persistent connection. Channels make use of Phoenix’s built-in websocket capabilities, so each connection runs in its own process and maintains its own state. This is a big difference from communication via HTTP, which is a stateless connection that only persists as long as the request and response cycle.

Example use-case

A good part of our business involves uploading 3D part files (usually…


Photo by Scott Webb on Unsplash
Photo by Scott Webb on Unsplash

Recently I was debugging some React code that was allowing a form to submit its contents even when the user did not check a required checkbox. Client side, HTML5 validations weren’t running at all, and the user had to wait for server errors to know that they had typed invalid input.

HTML5 validations should just work, right? If a field in a form is required, we should see the warning message pop up if the field is blank.


I love testing and am always looking for quality-of-life improvements that decrease the barriers to writing good tests. Here’s a small one with a big impact.

Problem: I can’t access react-modal from the component I’m testing

I’m working on a component that leverages react-modal and wraps it in a custom modal component. In this simplified example, I have a parent component that renders a button. On clicking this button, a modal opens containing a form to enter an email address.

This is because we…


gunshowcomic.com

In November I attended my first RubyConf and spent a whirlwind three days trying to learn all the things. Now that the dust has settled, here is part two of three themes that have crystalized, which I know I will find myself mulling over for weeks to come.

Read my other posts in this series: What If Ruby? and Failure.

The Existential Dilemma of Software Development

Where the existentialist writer Jean-Paul Sartre said that hell is other people, software developers would say that hell is other people’s code. But also our own code. Ok, maybe code in general. …


In November I attended my first RubyConf and spent a whirlwind three days trying to learn all the things. Now that the dust has settled, here is part two of three themes that have crystalized, which I know I will find myself mulling over for weeks to come.

TL;DR — Speakers and Talks

Failure

More specifically, what can be done about failure, given that it is as inevitable in software as strong opinions about text editors. More than one talk advised this: stare into…


RubyConf was all decked out for NOLA, design by Littlelines, LLC

In November I attended my first RubyConf and spent a whirlwind three days trying to learn all the things. Now that the dust has settled, here is the first of three themes that have crystalized, which I know I will find myself mulling over for weeks to come.

1. What if Ruby…?

In February 2018, Ruby will be 25 years old, and this year’s conference posed a lot of questions about the language. Yukihiro Matsumoto’s keynote questioned how he as a language designer can avoid breaking changes while still pushing new and exciting versions. …


Search for “decryption with GPG” online and you’ll come up with many resources for using GPG on the command line to decrypt a file. When my co-worker and I were recently charged with building decryption functionality into a Rails application, we found that there was a considerable gap between these manual scripts and the automated functionality we needed.

From someone new to encryption and relatively new to software development, here is my guide to composing GPG commands for programmatic key import and decryption.

Phase 1: Manually Import the Key and Decrypt

Note: anything you as the user need to supply is listed in < > . …


If you spend time around experienced developers, you’ll likely see them flying through their text editor and shell of choice with almost super-human speed, and they’ll probably have strong opinions about what text editor or shell to use as well as the best ways to navigate them.

Workflow can be overwhelming for new developers, especially those who have switched into the industry from another field via a bootcamp or code school. When I started my journey into software development, I often skipped over learning some keyboard shortcuts in favor of, you know, trying to learn how to program.

At the…

Erin Greenhalgh

Software developer; language enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store