AngularJS Web Application Development - Darwin, Peter Bacon (Packt Publishing, 2013)
Testing code that interacts with http
Cover; Copyright; Credits; About the Authors; Acknowledgments; About the Authors; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Angular Zen; Meet AngularJS; Getting familiar with the framework; Finding your way in the project; The community; Online learning resources; Libraries and extensions; Tools; Batarang; Plunker and jsFiddle; IDE extensions and plugins; AngularJS crash course; Hello World -- the AngularJS example; Two-way data binding; The MVC pattern in AngularJS; Bird's eye view; Scopes in depth; View; Modules and dependency injection
Modules in AngularJSCollaborating objects; Registering services; Modules lifecycle; Modules depending on other modules; AngularJS and the rest of the world; jQuery and AngularJS; Apples and oranges; A sneak peek into the future; Summary; Chapter 2: Building and Testing; Introducing the sample application; Getting familiar with the problem domain; Technical stack; Persistence store; MongoLab; Server-side environment; Third-party JavaScript libraries; Bootstrap CSS; Build system; Build system principles; Automate everything; Fail fast, fail clean; Different workflows, different commands
Build scripts are code tooTools; Grunt.js; Testing libraries and tools; Jasmine; Karma runner; Organizing files and folders; Root folders; Inside the source folder; AngularJS specific files; Start simple; Inside the test folder; File-naming conventions; AngularJS modules and files; One file, one module; Inside a module; Different syntax for registering providers; Syntax for declaring the configure and run blocks; Automated testing; Unit tests; Anatomy of a Jasmine test; Testing AngularJS objects; Testing services; Testing controllers; Mock objects and asynchronous code testing
End-to-end testsDaily workflow; Karma runner tips and tricks; Executing a subset of tests; Debugging; Summary; Chapter 3: Communicating with a Back-end Server; Making XHR and JSONP requests with http; Getting familiar with the data model and MongoLab URLs; http APIs quick tour; The configuration object primer; Request data conversion; Dealing with HTTP responses; Response data conversion; Dealing with same-origin policy restrictions; Overcoming same-origin policy restrictions with JSONP; JSONP limitations; Overcoming same-origin policy restrictions with CORS; Server-side proxies