javascript

Evaluating function return values with Jasmine

I’ve been using jasmine at work as a javascript test framework to cover front-end code with all sorts of tests. Recently, on one particular spec, I needed to capture the values returned by a spied upon fonction, without completely interrupting the code execution. As capturing returned values from a spy before continuing code execution is something I couldn’t find in the jasmine framework, I wrote a small integration test that required to use spyOn().andCallFake(), instead of spyOn().andCallThrough(). Here’s my attempt at an implementation.

read more

this=that

Just posting a link for you javascripters: incredibly useful reminder from Timbo on OO Javascript and the his follow ups on method and technical God boost for my start at betfair!

Mastermind

Latest fun tiny project: creating a small mastermind game in javascript in less than 1k for http://js1k.com/.

mastermind

Play here: http://mastermind.ekynoxe.com/ or download it from github and run it offline!

Rules are simple:

Guess by submitting with your keyboard numbers from 0-9 After pressing 4 digits the guess is automatically submitted The result shows symbols: * no symbol means no digit is in the code to guess * a ‘-’ means one of the digits is in the code to guess, but not at the correct place * a ‘+’ means one of the digits is in the code to guess, AND at the correct place If a digit exists twice in the code to guess, symbols do not represent it, you will have to get it by yourself! An alert is displayed when the code is found, and the game reset

Categories