Skip to content

Commit 2f5a5f6

Browse files
authored
test.browser.worker: use same PouchDB src as other tests (#8782)
There was no clear reason that to change the PouchDB source file, `tests/integration/browser.worker.js` used a different query param mapping from all the other integration tests (`sourceFile` vs `src`).
1 parent 9f01e63 commit 2f5a5f6

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

tests/common-utils.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,21 @@ commonUtils.loadPouchDBForNode = function (plugins) {
9999
return PouchDB;
100100
};
101101

102+
commonUtils.pouchdbSrc = function () {
103+
const scriptPath = '../../packages/node_modules/pouchdb/dist';
104+
const params = commonUtils.params();
105+
return params.src || `${scriptPath}/pouchdb.js`;
106+
};
107+
102108
commonUtils.loadPouchDBForBrowser = function (plugins) {
103-
var params = commonUtils.params();
104109
var scriptPath = '../../packages/node_modules/pouchdb/dist';
105-
var pouchdbSrc = params.src || `${scriptPath}/pouchdb.js`;
106110

107111
plugins = plugins.map((plugin) => {
108112
plugin = plugin.replace(/^pouchdb-(adapter-)?/, '');
109113
return `${scriptPath}/pouchdb.${plugin}.js`;
110114
});
111115

112-
var scripts = [pouchdbSrc].concat(plugins);
116+
var scripts = [commonUtils.pouchdbSrc()].concat(plugins);
113117

114118
var loadScripts = scripts.reduce((prevScriptLoaded, script) => {
115119
return prevScriptLoaded.then(() => commonUtils.asyncLoadScript(script));

tests/integration/browser.worker.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,7 @@ describe.skip('browser.worker.js', function () {
1717
before(function () {
1818
worker = new Worker('worker.js');
1919

20-
let sourceFile = window && new URLSearchParams(window.location.search).get('sourceFile');
21-
22-
if (!sourceFile) {
23-
sourceFile = '../../packages/node_modules/pouchdb/dist/pouchdb.js';
24-
} else {
25-
sourceFile = '../../packages/node_modules/pouchdb/dist/' + sourceFile;
26-
}
27-
28-
worker.postMessage(['source', sourceFile]);
20+
worker.postMessage(['source', testUtils.pouchdbSrc()]);
2921
});
3022

3123
function workerPromise(message) {

0 commit comments

Comments
 (0)