Categories
blog

React testing with Jest.

Jest is an open source JavaScript testing framework made by Facebook for React testing. Jest is built on top of Jasmine. Jasmine is a testing framework for JavaScript that is built on the principles of behaviour-driven development. Jasmine does not require any other JavaScript frameworks or even a DOM(Document Object Model). Jest is basically Jasmine on steroids. Some cool features of Jest include that it runs tests in parallel (making them faster), tests asynchronous code using inbuilt timer functions and automatically finds tests and can also be run from the command line. Jest’s coolest feature though, is the fact that it auto-mocks(eg tests everything) by default. You have to specify what not to test, instead of what to test.

React testing with Jest can be done in only a few steps. To install Jest, type npm install --save-dev jest-cli in the command line. After installing, create a directory inside your app called __tests__. This directory will contain all your tests.Then, create a Jest test. Define what Jest should not mock and then setup the test. Run Jest from the command line to start your testing. Run Jest by typingnpm test

An example of a Jest.


//Tells what not to mock
jest.dontMock('../sum.js');

//The mock starts here. The mock is named.
describe('sum', function() {
//Describes what the Mock does.
it('finds the sum of two numbers', function() {
//What is required for the mock to work
var sum = require('../sum.js');
//What the mock will do and what it is expected to match
expect(sum(1, 2)).toBe(3);
});
});

Categories
blog

Customize WordPress themes instead of building them.

When making a website, customize WordPress themes instead of building WordPress themes from scratch.

This will save you a lot of time, and help you achieve the most important part of any work: delivery on time. Developing the theme is where most of the time is spent on any website project. This is also probably the cause of most of the delays. Customize WordPress themes that are already available for sale or free, instead of creating them from scratch. This will avoid pretty much all of your delays.

When the wheel exists, why reinvent it? When you are working on a commercial project for a client, they want they work done well and they want it done fast. They do not care if you customize wordpress themes or hand-coded it, as long as it gives them what they want. No website should be made anymore that is not responsive. For that, you are probably already using a framework like bootstrap or foundation or many others. This saves so much time, as once you’ve learnt it, you can go crazy with it without spending too much time on it. The client’s are also in many cases familiar with these frameworks, so they do not have to be taught how to use them(for the most part).

The quality of available commercial themes available for WordPress has increased rapidly in the last few years. The support is fast and helpful as well. WordPress themes also get regular updates, meaning it will be use-able for many years to come. Whatever you need in a theme, somebody already has it for sale. We build websites on WordPress for reasons like saving time and having a dependable CMS that always works and can pretty much do whatever we need it to do. Customizing themes is one way to follow that.

Categories
blog

Coding Parties in L.A.

“All for a chance to be a star”
-No More Parties In L.A.


Coding bootcamps is the in thing. Like spiked hair in the 2000s, or terrible mullets of this era. Now it seems everyone needs to know coding(terrible fashion sense not optional). Doesn’t matter if you are the president or a barista, you gotta know coding. Even though one wonders why people of those professions would even need coding skills. Not only do you need to know coding, but you have to be a master coder in 24 hours and get hired as a super senior developer at TwatBook. Coding for just a singular goal like that is like learning a popular song completely and expecting to be more than a cover band.

Think about people that truly excel at what they do. Did they achieve it overnight? Did they pay somebody a bunch of money and do a couple of things for less than a year and boom…mastery achieved? No. Mastery takes a life time of practice and dedication. According to many experts, at least 10000 hours. That’s more than a year of practice, which is way way higher than the few hours for 6 months that will make you an expert(according to most bootcamps).That’s why no one becomes an engineer or a doctor in months. A few projects can teach you the basics, but never more than that. If there’s one thing I’ve seen online, it’s that things(apps, websites, etc.) are very poorly made using whatever is the fad of the day, approved by people who aren’t qualified and made by people who don’t know any anything better than hacks. That is the culture of doing things based on hype and trends, not needs. Remember those Angular apps which were made using Angular “just cause” ?

Bootcamps can at best find out those very few diamonds in the rough to start them on their path and take those that already know to the next level. A life time of mastery is not achieved overnight and by paying $40000 (most bootcamps charge at this range. Materials needed cost extra.) for six months. A portfolio of dream projects does not compete against a portfolio of real world implementations. In the fantasy world, everyone can do everything. In the real world that is unnecessary. So if programming is your thing or interests you as career and not only because of the monetary benefit, by all means try it out. But stick to it and get proper education. A coding bootcamp at best is only a tiny part of that education. No one became a rockstar for the money, they did it for the art. Programming is an art. Bootcamps are steroids and steroids are generally harmful.