Testing API Calls
In this post, we’ll look at testing API calls by setting up mock responses.
In this post, we’ll look at testing API calls by setting up mock responses.
In this post, we’ll look at testing asynchronous Redux actions.
The Enzyme package, from Airbnb, appears to solve some of the problems I ran into when using plain Jest. “Enzyme is a JavaScript Testing utility for React that makes it easier to assert, manipulate, and traverse your React Components’ output”. For example, with Enzyme, I was able to use a .click method much like RSpec […]
In my portfolio-analyzer repository, containing a Rails API back end and a JavaScript front end, all of the Rails testing is done with RSpec. With a small amount of setup, RSpec testing is as simple as navigating to a page and ‘clicking’ an element. It is incredibly readable. visit ‘http://localhost:3000’ page.first(‘#portfolioEdit’).click fill_in “Name”, :with => […]
The application is a Rails API backend with a Javascript frontend, in a single GitHub repository. All the Rails testing for models and controllers is done with RSpec. For expediency, I thought I’d try RSpec to perform feature tests on the javascript frontend rather than add a second testing framework. Through a lot of trial […]
I have an app that retrieves 640 data points from a Postgres database with a two-table join. The join was taking about 3 minutes to return results, so I decided to see if that could be improved. I examined the query plans and added a distinct clause to the query. This dropped the query response time […]
I have an app that retrieves 640 data points from a database (from the Series table) that are then rendered to JSON and sent to the client to be plotted on a chart. Active Record assembles an object from one or more database records. Since the Series class includes the Instrument class, each Series object […]
Depending on the application, JSON data transfers can be costly in terms of response time and data size. When your data model has nested associations, each association gets fully converted into JSON. This can lead to a lot of duplicated data being serialized and transmitted. Sideloading repetitive association data is a way to reduce JSON payloads and […]
When we use a relational database, we are using database transactions. By default, every SQL statement (select, insert, update, etc.) executes within its own transaction. A transaction incurs a lot of overhead. When we need to process lots of SQL statements at a time, our application’s performance can suffer greatly. Background A database transaction represents […]
My latest portfolio project centered around the use of React and Redux. Maintaining state using these libraries involves plenty of object copying. The state provided to the app is meant to be read-only. To make a change to the state, the app presents a new version of the state to the libraries, which take care […]