|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | | -describe('constructor errors', function () { |
| 3 | +describe('constructor errors', () => { |
4 | 4 |
|
5 | | - it('should error on an undefined name', function (done) { |
| 5 | + it('should error on an undefined name', () => { |
6 | 6 | try { |
7 | 7 | new PouchDB(); |
8 | | - done('Should have thrown'); |
| 8 | + throw new Error('Should have thrown'); |
9 | 9 | } catch (err) { |
| 10 | + if (err.message === 'Should have thrown') { |
| 11 | + throw err; |
| 12 | + } |
10 | 13 | should.equal(err instanceof Error, true, 'should be an error'); |
11 | | - done(); |
12 | 14 | } |
13 | 15 | }); |
14 | 16 |
|
15 | | - it('should error on an undefined adapter', function (done) { |
| 17 | + it('should error on an undefined adapter', () => { |
16 | 18 | try { |
17 | 19 | new PouchDB('foo', {adapter : 'myFakeAdapter'}); |
18 | | - done('Should have thrown'); |
| 20 | + throw new Error('Should have thrown'); |
19 | 21 | } catch (err) { |
| 22 | + if (err.message === 'Should have thrown') { |
| 23 | + throw err; |
| 24 | + } |
20 | 25 | should.equal(err instanceof Error, true, 'should be an error'); |
21 | 26 | err.message.should |
22 | 27 | .equal('Invalid Adapter: myFakeAdapter', |
23 | 28 | 'should give the correct error message'); |
24 | | - done(); |
25 | 29 | } |
26 | 30 | }); |
27 | 31 |
|
28 | | - it('should error on an undefined view adapter', function (done) { |
| 32 | + it('should error on an undefined view adapter', () => { |
29 | 33 | try { |
30 | 34 | new PouchDB('foo', {view_adapter : 'myFakeViewAdapter'}); |
31 | | - done('Should have thrown'); |
| 35 | + throw new Error('Should have thrown'); |
32 | 36 | } catch (err) { |
| 37 | + if (err.message === 'Should have thrown') { |
| 38 | + throw err; |
| 39 | + } |
33 | 40 | should.equal(err instanceof Error, true, 'should be an error'); |
34 | 41 | err.message.should |
35 | 42 | .equal('Invalid View Adapter: myFakeViewAdapter', |
36 | 43 | 'should give the correct error message'); |
37 | | - done(); |
38 | 44 | } |
39 | 45 | }); |
40 | 46 |
|
41 | | - it('should error on a null name', function (done) { |
| 47 | + it('should error on a null name', () => { |
42 | 48 | try { |
43 | 49 | new PouchDB(null); |
44 | | - done('Should have thrown'); |
| 50 | + throw new Error('Should have thrown'); |
45 | 51 | } catch (err) { |
| 52 | + if (err.message === 'Should have thrown') { |
| 53 | + throw err; |
| 54 | + } |
46 | 55 | should.equal(err instanceof Error, true, 'should be an error'); |
47 | | - done(); |
48 | 56 | } |
49 | 57 | }); |
50 | 58 |
|
|
0 commit comments