A lot of people are still using AngularJS. It’s hard to port your entire application to a new platform and even language. This week we had a student who asked a very good question: how do you unit test forms in AngularJS? Well, this article got me started. I wanted to put it in context … Read More
Note – This article is an updated version of the rc1 version, and as such it now covers Angular 2.0.1 and above, the official release of 2.0. The main difference here is the way the framework is started, using the TestBed API. Testing Components In my last post, I discussed how to write tests in … Read More
So you’d like to test your HTTP services in Angular 2.0 but you don’t know how? Have some background in Angular 1’s ngMock library? Or just want to see how it’s done? Read this article and follow along with the provided GitHub repo to learn how. Chariot’s Ken Rimple, co-author of our Angular 2 and React training courses, shows you how.
Note – I’ve updated this article and created a new github project using angular-cli to test it. Run all tests with ng test after following instructions at https://github.com/krimple/angular2-unittest-samples-rc Testing Components In my last post, I discussed how to write tests in Angular 2 based on the new angular-testing API. We learned how to stand up … Read More
Right now it's hard to find samples of tests against Angular 2 observable Http code for developers in the current beta. Some of the things you have to watch out for are non-obvious. I expect this will improve vastly over time, but for now hopefully you'll get some working code samples from me to get you going. This post will show you how it’s done.
AngularJS provides two powerful mock and test support modules, both contained in a single script file. The modules, ngMock and ngMockE2E, provide different features for different purposes, though both modules are defined in, angular-mocks.js. In this post I’ll explain the differences between the modules and how they get mounted in a test scenario.