Skip to content

Commit e434fe2

Browse files
committed
refactor: use async/await, const and arrow function
1 parent 1cf3108 commit e434fe2

1 file changed

Lines changed: 21 additions & 13 deletions

File tree

tests/integration/test.constructor.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,58 @@
11
'use strict';
22

3-
describe('constructor errors', function () {
3+
describe('constructor errors', () => {
44

5-
it('should error on an undefined name', function (done) {
5+
it('should error on an undefined name', () => {
66
try {
77
new PouchDB();
8-
done('Should have thrown');
8+
throw new Error('Should have thrown');
99
} catch (err) {
10+
if (err.message === 'Should have thrown') {
11+
throw err;
12+
}
1013
should.equal(err instanceof Error, true, 'should be an error');
11-
done();
1214
}
1315
});
1416

15-
it('should error on an undefined adapter', function (done) {
17+
it('should error on an undefined adapter', () => {
1618
try {
1719
new PouchDB('foo', {adapter : 'myFakeAdapter'});
18-
done('Should have thrown');
20+
throw new Error('Should have thrown');
1921
} catch (err) {
22+
if (err.message === 'Should have thrown') {
23+
throw err;
24+
}
2025
should.equal(err instanceof Error, true, 'should be an error');
2126
err.message.should
2227
.equal('Invalid Adapter: myFakeAdapter',
2328
'should give the correct error message');
24-
done();
2529
}
2630
});
2731

28-
it('should error on an undefined view adapter', function (done) {
32+
it('should error on an undefined view adapter', () => {
2933
try {
3034
new PouchDB('foo', {view_adapter : 'myFakeViewAdapter'});
31-
done('Should have thrown');
35+
throw new Error('Should have thrown');
3236
} catch (err) {
37+
if (err.message === 'Should have thrown') {
38+
throw err;
39+
}
3340
should.equal(err instanceof Error, true, 'should be an error');
3441
err.message.should
3542
.equal('Invalid View Adapter: myFakeViewAdapter',
3643
'should give the correct error message');
37-
done();
3844
}
3945
});
4046

41-
it('should error on a null name', function (done) {
47+
it('should error on a null name', () => {
4248
try {
4349
new PouchDB(null);
44-
done('Should have thrown');
50+
throw new Error('Should have thrown');
4551
} catch (err) {
52+
if (err.message === 'Should have thrown') {
53+
throw err;
54+
}
4655
should.equal(err instanceof Error, true, 'should be an error');
47-
done();
4856
}
4957
});
5058

0 commit comments

Comments
 (0)