diff --git a/tools/tests/apps/dynamic-import/tests.js b/tools/tests/apps/dynamic-import/tests.js index 0905ce7386..03a9b39d03 100644 --- a/tools/tests/apps/dynamic-import/tests.js +++ b/tools/tests/apps/dynamic-import/tests.js @@ -1,6 +1,21 @@ import assert from "assert"; describe("dynamic import(...)", function () { + if (global.indexedDB) { + const saveCache = process.env.METEOR_SAVE_DYNAMIC_IMPORT_CACHE; + if (! (saveCache && JSON.parse(saveCache))) { + it("cleared the IndexedDB cache", function () { + return new Promise((resolve, reject) => { + const deleteRequest = + global.indexedDB.deleteDatabase("MeteorDynamicImportCache"); + deleteRequest.onerror = + deleteRequest.onblocked = + deleteRequest.onsuccess = resolve; + }); + }); + } + } + it("import same module both statically and dynamically", function () { import moment from "moment"; return import("./imports/date").then(date => { diff --git a/tools/tests/dynamic-import.js b/tools/tests/dynamic-import.js index e667952907..fc80941d39 100644 --- a/tools/tests/dynamic-import.js +++ b/tools/tests/dynamic-import.js @@ -13,6 +13,13 @@ selftest.define("dynamic import(...) in production", function () { s.cd("dynamic-import-test-app-prod", run.bind(s, true)); }); +selftest.define("dynamic import(...) with cache", function () { + const s = new Sandbox(); + s.createApp("dynamic-import-test-app-cache", "dynamic-import"); + s.set("METEOR_SAVE_DYNAMIC_IMPORT_CACHE", "true"); + s.cd("dynamic-import-test-app-cache", run.bind(s, true)); +}); + function run(isProduction) { const sandbox = this; const args = [