In the last two blog posts, you learned that Ember treats testing as a first-class citizen. Out of the box, Ember provides 3 types of tests so that you can fine-tune test coverage and performance. It also supports a variety of addons and debugging tools to improve your developer experience in testing.
Today, we address an important question: How should you write tests? By the end of this post, you will learn 5 simple rules that I like to follow. The rules aren’t do-this-or-do-that’s (cold hard facts). Instead, they carry nuance and interesting side stories. To keep your learning experience fun, I will transcribe my talk at EmberFest 2019 (rather than summarizing it) to engage in a dialogue with you.
In December 2016, my club, Central Austin Toastmasters, achieved something that very few clubs in the world get to do. We built our own website, centralaustin.org, so that our members have the right tools to succeed in Toastmasters.
Thanks to our website, we are stronger than ever in our 27-year club history.
We have 40 awesome members, each dedicated to improve their public speaking and leadership skills.
We have won 12 awards in the past two years.
And we currently stand at #2 out of 186 clubs in Austin and San Antonio. This is truly one of the best places you can be for Toastmasters.
We are not going to stop here, though, because there is always room for us to grow. Today, I present to you a club project that will help us evolve in 2019 and 2020: a new Pathways app that I call, Toastmasters Education Tracker (*name subject to change). Let me explain why we need this app, how we are going to make it, and how you can help.
Two months ago, I got to use D3 to help visualize the steps for getting something approved and interact with these steps. I affectionally call my code Roadmap.
I had a great time because (1) the way we draw things in D3 reminded me of Matlab, whom I will always love; (2) I got to re-learn graph theory (fun fact: all digraphs have a topological sort—being able to sort is always nice and being able to in linear time even more so); and (3) I got to play with Post-it notes to make up an algorithm for drawing graphs on desktop and mobile.
I also had a hard time finding out how to use D3 in Ember. Because Ember is rather a rare species, there was only 1 tutorial that helped me understand what I needed to do. Thanks to that tutorial, I was able to create a prototype of Roadmap over a weekend, use Ember’s mixin feature effectively, and write extensive tests to show that Roadmap really works. In case you want to learn Ember and D3, let me show you what I learned.
We will create a game from the 90s called Lights Out. The game consists of a 5 x 5 grid of lights, which you can press like buttons. When the game starts, some of the lights are on. When you press a light, that light and its adjacent ones—top, right, bottom, and left, if they exist—are switched from on to off, or off to on. The goal of the game is for you to turn off all lights, preferably in as few moves as possible.