Testing AJAX with Web Component Tester — Polycasts #37

1451130333_maxresdefault.jpg



Elements that need to get data from a backend service can be tricky to test. Do you need to startup your own test server just to verify an element does what it’s supposed to? Is that even a good idea? Today on Polycasts I’ll show you have to use Web Component Tester and a library called Sinon.js to mock your back end and speed up your unit tests. By mocking your backend you can verify that your element’s work in isolation, which is a crucial step to having good overall test coverage of your app.

Web Component Tester
https://github.com/Polymer/web-component-tester

Iron Ajax
https://github.com/PolymerElements/iron-ajax

Sinon.js
http://sinonjs.org/

Chai Expect
http://chaijs.com/api/bdd/

Polymer Slack: http://bit.ly/polymerslack
Polymer G+: https://plus.google.com/communities/115626364525706131031

Subscribe to the Chrome Developers channel at http://goo.gl/LLLNvf

source

December 26th, 2015 by