Mastodon

Lessons Learned in October 2018

This is what I learned in October 2018:

  1. After creating some spies with Jest, I got a “cannot find name ‘jest’” error in Typescript. This article got the answer: Jest had to be added as a type in tsconfig.app.json files.
  2. Recently, I wanted to implement a toggling icon with Font Awesome in Angular. The article “Toggle Fontawesome Icons in Angular using fontawesome/angular-fontawesome” gave me the right hint: multiple Fontawesome icons with the same name can be declared in Angular using the “as” keyword:
import { faStar as faStarB }from '@fortawesome/free-solid-svg-icons'; //<==== Expicit
import { faStar }from '@fortawesome/free-regular-svg-icons'; //<==== Expicit
  1. I was looking for the right HTTP return code for data that got to the server in the right format, but was invalid in a business logic sense. This article suggests using HTTP-422: “The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415 (Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions. For example, this error condition may occur if an XML request body contains well-formed (i.e., syntactically correct), but semantically erroneous, XML instructions.”
  2. Some while ago, I found this upgrade-guide for Angular. It lists the steps involving in getting from one version of the framework to the other.

(Photo: adrian825, http://www.istockphoto.com/photo/monthly-management-reports-36658768)