My learning diary

Jest for the First Time

I needed to test a feature which I’ve been building for GovTech’s FormSG. To test it, I had to mock a function in the superclass of an instance generated by a factory method call. I once considered stripping away the barriers between the mock and the test. But, I didn’t want to refactor a codebase which I’m not too familiar with. Below is a visualisation of the “barriers” between the mock and the test:

Continue reading "Jest for the First Time"

Adding my sites to Cloudflare

I added my domains to Cloudflare. Cloudflare offers many cool features that my domain providers don’t offer. Well, they didn’t need to offer those features. In Cloudflare, I get to see features such as: Web traffic analytics Set up DNSSEC Configure network transport options and/or optimisations Run speed tests on my site Configure caching Run JavaScript workers Restrict image hotlinking This list is non-exhaustive. There are more features in the Pro and Enterprise subscriptions.

Continue reading "Adding my sites to Cloudflare"

Custom domains

A few days ago, I purchased the jiayee.net domain. Yesterday, I purchased the jiay.ee domain. It was a novel experience for me. I last “purchased” a domain from Freenom about 3 years ago. Back then, I had the free domain point to my AWS EC2 public IP address (this was for CS3216). This week, my custom domains are pointing towards GitHub pages and Blogger respectively. For GitHub pages, I followed a guide which is like this one by Rich.

Continue reading "Custom domains"

My first yarn package

I wrote my first yarn package (kind of for fun) yesterday. It’s strange how I’ve been consuming packages but never went to the other side of the table: Writing a package. As of now, I haven’t published my package, but I’m omw. So, how did I create a package? It just felt like the usual… I followed the yarn docs. One difference (compared to my usual activities) was I couldn’t do import { .

Continue reading "My first yarn package"

Almost done with the custom starter

I was right. I forgot to enable the Mongo repository. And it wasn’t only that. I had two Mongo configuration classes. One in the consumer and another in the custom starter. I needed only one. I removed the configuration class from the custom starter. Then, I enabled the custom starter’s repository in the consumer’s configuration class. Below is an idea of how my configuration class looks like: @EnableMongoRepositories(basePackages = { "yourTLD.

Continue reading "Almost done with the custom starter"