UI for Zipcoin Blue

test.faultydriver.js 1.0KB

1234567891011121314151617181920212223242526272829303132
  1. /* global describe:true, expect:true, it:true */
  2. describe('When Driver Fails to Initialize', function() {
  3. 'use strict';
  4. var FAULTYDRIVERS = [
  5. localforage.WEBSQL
  6. ];
  7. FAULTYDRIVERS.forEach(function(driverName) {
  8. it('fails to setDriver ' + driverName + ' [callback]', function(done) {
  9. localforage.setDriver(driverName, function() {
  10. localforage.ready(function(err) {
  11. expect(err).to.be.an(Error);
  12. expect(err.message).to.be('No available storage method found.');
  13. done();
  14. });
  15. });
  16. });
  17. it('fails to setDriver ' + driverName + ' [promise]', function(done) {
  18. localforage.setDriver(driverName).then(function() {
  19. return localforage.ready();
  20. }).then(null, function(err) {
  21. expect(err).to.be.an(Error);
  22. expect(err.message).to.be('No available storage method found.');
  23. done();
  24. });
  25. });
  26. });
  27. });