Just a better way to test AngularJS apps.
AngularJS and its dependency injection make it very easy to isolate your code under test.
Unfortunately, coding up stubs for those services can get tedious (many services injected, many modules depending upon modules), and you could end up with a fixture that dwarfs your assertions.
angular-debaser attempts to reduce the size of your fixtures and make them natural to write.
Given the following beastly fixture and test:
We'll use angular-debaser instead. It becomes this:
(If you're counting, that's about half as many lines.)
Interested? Trying to test something that injects 46 services?? You may want to read the tutorial & go down the rabbit hole.
If Sinon.JS is present, see this API for working with functions.
Optionally, save it to your
bower.json: you probably don't want to use
Dependencies & Recommended Packages
Required, but not marked as dependencies:
- sinon-ng for working with
bower install sinon-ng
Depending on your test runner setup, you may want to install these either via
- Sinon.JS for stubbing/spying
- Sinon-Chai or jasmine-sinon for BDD-style Sinon.JS integration.
Chai-as-Promised for Chai assertions against Promises
Copyright © 2014 Decipher, Inc. Licensed MIT.