Decorators in TypeScript

3Decorators are an experimental feature of TypeScript and, to an extent, of JavaScript itself. They are a concept borrowed from Python, and a way to modify classes using higher order functionality.

The idea is that you pass the class/function/attribute through a function and the result becomes the class/function/attribute.

As an example, if you make a @final decorator and have the code…

Continue reading “Decorators in TypeScript”

Testing Angular Services

Rick HerrmannUntil recently, the front-end testing I’d done had not directly tested any Angular services. In almost every case, the $http calls in the services were just returning data from an API back to a controller. However, on a recent project I had a scenario where the data from the API had to have some filtering and permission logic applied before passing on the data. This was a case where unit testing the service made sense.

As it turns out, testing a service is very similar to testing a controller in terms of setting up the test, injecting dependencies, and making assertions. The only real difference is the need to mock the $http call in the service. To do this the angular-mocks library provides the $httpBackend tool. Let’s walk through an example of testing a service.

Continue reading “Testing Angular Services”

Wading into the kiddy pool of Azure Web API

Mike BerrymanMicrosoft’s Azure service has been around for quite a while now, but I’ve never had a reason to do much with it since many of my clients are not “in the cloud”.  Until now, that is.  One of my SharePoint Clients is undertaking an initiative to move from their on-premise server to SharePoint Online, which presents some unique challenges for the custom solutions I had developed for them over the years.

Continue reading “Wading into the kiddy pool of Azure Web API”

Mocking Time with sinon.js

Rick HerrmannI was writing some tests for an Angular app and ran into a scenario where I needed a page to behave differently if the time of day was before or after 6AM.  The logic is simple enough to capture in my controller:

vm.date = moment().subtract(6, 'hours').toDate();

Basically, if it is before 6AM, display the prior day, otherwise display today. However, as I was trying to write a test for this controller the problem came up: how do I take control of the current time to test both scenarios?

Continue reading “Mocking Time with sinon.js”

Meteor.js CodeMash Staff Application

Scott ZischerkNote: If you have interest in checking out the project, you can find it here:
https://github.com/InteractiveBusinessSystems/cm_staff_app

Background

If you’re not familiar with CodeMash, it’s a technology conference hosted at the Kalahari Resort & Indoor Water Park in Sandusky, OH:

CodeMash is a unique event that will educate developers on current practices, methodologies, and technology trends in a variety of platforms and development languages such as Java, .NET, Ruby, Python and PHP.

Continue reading “Meteor.js CodeMash Staff Application”

Codemash 2016 – Humanitarian Toolbox

Rick HerrmannFor the second Codemash pre-compiler day I spent the full day working on the Humanitarian Toolbox project @htbox) with Bill Wagner (@billwagner) and Tony Surma (@tonysurma) and 5 other developers.

What is it?

The Humanitarian Toolbox is an open source non-profit organization, that creates software for disaster response teams. To kick things off, Tony gave us an overview of the projects and we pulled the code from GitHub.

Continue reading “Codemash 2016 – Humanitarian Toolbox”