jvandemo / generator-angularjs-library

A generator for Yeoman to generate the boilerplate for creating an AngularJS library
117 stars 33 forks source link

Testing promises #35

Open ivandroid opened 8 years ago

ivandroid commented 8 years ago

How can you test promises? Is that possible?

jvandemo commented 8 years ago

@ivandroid — Can you elaborate on what you wish to test?

The reason that is important is because some native Angular services have mock services and other (third-party) services may not have mocks.

There is also a StackOverflow post on how to test promises using Mocha here.

ivandroid commented 8 years ago

To put it another way... In my library I'm using a websql database for storage. The database actions are implemented within a service. While testing the function which creates a new db via window.openDatabase(...) I'm getting a security error from PhantomJS. I thought this error has something to do with promises but it doesn't. Any idea?

jvandemo commented 8 years ago

@ivandroid — Unfortunately that is hard to judge without seeing code.

Is it possible to provide a Plunk on plnkr.co?

Thanks in advance!