No free lunch … No wait, free lunch!
When someone wants to give you a talk about javascript testing, free food and drinks I’m generally all for it. So there was a natural attraction to Valtech’s event the 16:th of October. The only snag is that Stockholm is pretty far from Växjö, and the train is not free either. But since they wanted to give me a price for winning the hacker challenge, the Valtech GUI Challenge, they held at Nordic.js I managed to talk my boss into letting me go.
Testing javascript
So the first issue on the agenda for the evening was a talk by Janko Luin about testing Javascript. It was a good introductory talk where he went through the major players when it comes to JavaScript testing frameworks and showed som examples of how to decouple your jQuery/DOM bound JavaScript to allow for easier testing.
His suggestion of making the interaction minimal so that you don’t have to mock a lot of HTML in your tests is fair. I have lately started using a version of the adapter pattern to combat the same issue. Basically I have an object layer responsible only for talking to the DOM, it’s dumb and has no logic what so ever. The actual logic is then held in a separat layer one step removed and can be tested without bothering about the DOM at all.
It might not be perfect, and I should probably write a longer post about it, but it works fine for the more complicated interactions with the DOM that we have in Fortnox where even simplifying the mocked HTML would mean mocking a lot …

15 minutes of fame
Next up was me as I received my price. It consisted of a huge, novelty size diploma and a shiny golden goblet (distinctly not on fire, which was a slight disappointment). It was all very nice with proper handshaking and photo-op and stuff, but with a twist I’m sure that Valtech never thought of:
So, the thing is that I was sleeping at a friends that night, in Solna outside of Stockholm, which means going by subway for 20 minutes and a fair walk. The next day I had to take the subway back to catch a train really early. I then had no less than five changeovers during the day with a stop in the middle for coffee with Hakim El Hattab for the first time (first impressions lasts and such).
The diploma doesn’t fit in any locker nor bag and the goblet didn’t realistically fit in my bag either, not without some serious violence. So all of this travel and all of the changeovers where done with a huge, novelty, A2 diploma under one arm and a rather large and conspicuous golden goblet in the other.
The short of it is that apparently this is a good way to travel if you want to talk a lot to strangers. I’d recommend having won something more relatable to the general public than a hacker competition though. Makes for shorter conversations while hurrying to the next mode of transport.
Food and mingle
After the talk and the price “ceremony” it was time for food and drinks. Valtech had arranged for a hamburger wagon to arrive outside and the queue was long for a while while people got their newly grilled with fries outside and some nice, refreshing juice inside.
I stayed for a few hours more and mingled and talked to a few people about programming, Valtech, freelancing, JavaScript testing and being a 1337 haxxor. All in all it was a very nice evening and I’d love to go again if the opportunity presents itself.
For those of you living in Stockholm Valtech does this kind of thing on a regular basis and you should definitively check it out. Their event calendar can be found at valtech.se/events.