Posts

Showing posts from September, 2014

Publish-Subscribe Pattern with Postal.js

Image
Last week we talked about testing JavaScript Testing with Jasmine  and today I'd like to continue our conversation about testing rather from different angle - separation of concerns . Once the code slips developers' fingers, it is hard to find time and strength to rewrite, it making it more testable. What works, may never be rewritten, sounds a bit like Iron island refrain  What is dead, may never die :) Hmm - sorry for that! Nearly all today's applications have some calls to somewhere to retrieve the data. Front side retrieves from the server. Server side retrieves from services or database. Some manipulate it, others just format it and present as it is. Take a look at the following examples: function someLogic() { $.get("ajax/test.html", function (data) { $(".result").html(data); }); } function someLogic() { dataManager.getClients(function (err, data) { if (!err) { doSomething(data); } }); } How can you test it? First of all th