Skip to content

Commit d660e61

Browse files
committed
refactor: remove then and use async/await syntax
1 parent c687a28 commit d660e61

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

tests/find/test-suite-2/test.kitchen-sink-2.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ describe('pouchdb-find: test.kitchen-sink-2.js', function () {
7272

7373
testConfigs.forEach((testConfig, i) => {
7474

75-
const kitchenSinkTest = () => {
75+
const kitchenSinkTest = async () => {
7676
const db = context.db;
7777
const query = testConfig.input;
7878
query.fields = ['_id'];
79-
return db.find(query).then((res) => {
79+
try {
80+
const res = await db.find(query);
8081
if (testConfig.output.res) {
8182
const ids = res.docs.map((x) => x._id);
8283
if (!testConfig.input.sort) {
@@ -90,13 +91,13 @@ describe('pouchdb-find: test.kitchen-sink-2.js', function () {
9091
res.warning.should.equal('no matching index found, create an ' +
9192
'index to optimize query time');
9293
}
93-
}, (err) => {
94+
} catch (err) {
9495
if (testConfig.output.res) {
9596
should.not.exist(err, 'should not have thrown an error');
9697
} else {
9798
should.exist(err);
9899
}
99-
});
100+
}
100101
};
101102

102103
const testName = `kitchen sink 2 test #${humanizeNum(i)}`;

tests/find/test-suite-2/test.kitchen-sink.js

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)