This was a Facebook contest for Hatfield Quality Meats that allowed fans to enter a contest daily by flipping a patty of meat, for a chance to win prizes.

To make sure users could only enter once and only try to win once per day the app requested access to a user’s basic information.

Whether or not a user won was determined by sending a AJAX post to the server. The server ran the flip logic, saved the entry to the database and returned the result to the browser.

When the response was received the JavaScript triggered some animation with jQuery and then sent a message to a Flash movie to playback based on the result.

Because of the different requirements and states the app could be in I took the time to create tests for every method to try and ensure that nothing went wrong.