Skip to content

Commit 422b0ac

Browse files
committed
Merge branch 'fix/pouchdb-search-init' into beta
2 parents 4600e77 + 36f0bf4 commit 422b0ac

File tree

4 files changed

+86
-39
lines changed

4 files changed

+86
-39
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"test": "npm run test-main && npm run test-renderer && npm run test-app",
1919
"test-main": "NODE_ENV=test ELECTRON_PATH=node_modules/.bin/electron electron-mocha test/**/*.main.spec.js scripts/packages/**/*.main.spec.js",
2020
"test-renderer": "NODE_ENV=test ELECTRON_PATH=node_modules/.bin/electron electron-mocha --renderer --require-main 'test/renderer-setup-paths.js' scripts/packages/**/*.renderer.spec.js",
21-
"test-app": "NODE_ENV=test ELECTRON_PATH=node_modules/.bin/electron mocha test/**.app.spec.js",
21+
"test-app": "NODE_ENV=test ELECTRON_PATH=node_modules/.bin/electron mocha test/**.app.spec.js --timeout 10000",
2222
"test-win-all": "npm run test-win-main && npm run test-win-renderer && npm run test-win-app",
2323
"test-win-main": "node node_modules/.bin/electron-mocha test/**/*.main.spec.js scripts/packages/**/*.main.spec.js",
2424
"test-win-renderer": "node node_modules/.bin/electron-mocha --renderer scripts/packages/**/*.renderer.spec.js",

src/arc-electron.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import styles from './AppStyles.js';
2121
import poweredIcon from './poweredby.js';
2222
window.PouchDB = PouchDB;
2323
window.PouchQuickSearch = PouchQuickSearch;
24+
window.PouchDB.plugin(window.PouchQuickSearch);
2425
window.marked = marked;
2526
window.Jexl = Jexl;
2627
/* eslint-disable max-len */

test/database.app.spec.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const bootstrap = require('./test-bootstrap.js');
2+
const { assert } = require('chai');
3+
const path = require('path');
4+
const fs = require('fs-extra');
5+
6+
describe('PouchDB integration', function() {
7+
describe('PouchdbQuickSearch', () => {
8+
let app;
9+
before(async () => {
10+
app = bootstrap.getApp();
11+
try {
12+
await app.start();
13+
await app.client.waitUntilWindowLoaded(10000);
14+
} catch(cause) {
15+
if (app && app.isRunning()) {
16+
await app.stop();
17+
}
18+
throw cause;
19+
}
20+
});
21+
22+
after(async () => {
23+
if (app && app.isRunning()) {
24+
await app.stop();
25+
}
26+
const basePath = path.join('test', 'playground');
27+
await fs.remove(basePath);
28+
});
29+
30+
it('Registers quicksearch plugin', async () => {
31+
const init = await app.client.element('arc-electron');
32+
assert.ok(init);
33+
const result = await app.client.execute(() => {
34+
/* global PouchDB */
35+
const db = new PouchDB('saved-requests');
36+
const to = typeof db.search;
37+
return {
38+
to
39+
};
40+
});
41+
const queryResult = result.value;
42+
assert.equal(queryResult.to, 'function');
43+
});
44+
});
45+
});

0 commit comments

Comments
 (0)