Skip to content

Commit 4c92647

Browse files
committed
fix: unit tests should work in electron as well part 1
1 parent d8aa90e commit 4c92647

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

test/SpecRunner.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@
213213
e.preventDefault();
214214
window.electronAPI.toggleDevTools();
215215
}
216+
if (e.key === 'F5') {
217+
e.preventDefault();
218+
location.reload();
219+
}
216220
});
217221
}
218222
</script>

test/spec/ExtensionInstallation-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ define(function (require, exports, module) {
3131

3232
const testFilePath = SpecRunnerUtils.getTestPath("/spec/extension-test-files");
3333

34-
const tempDirectory = window.__TAURI__ ? Phoenix.VFS.getTauriAssetServeDir() + "tests": SpecRunnerUtils.getTempDirectory();
34+
const tempDirectory = Phoenix.isNativeApp ?
35+
Phoenix.VFS.getTauriAssetServeDir() + "tests": SpecRunnerUtils.getTempDirectory();
3536
const extensionsRoot = tempDirectory + "/extensions";
3637

3738
const basicValidSrc = testFilePath + "/basic-valid-extension.zip",
@@ -79,7 +80,7 @@ define(function (require, exports, module) {
7980

8081
beforeAll(async function () {
8182
await SpecRunnerUtils.ensureExistsDirAsync(tempDirectory);
82-
if(window.__TAURI__){
83+
if(Phoenix.isNativeApp){
8384
basicValid = tempDirectory + "/basic-valid-extension.zip";
8485
missingNameVersion = tempDirectory + "/missing-name-version.zip";
8586
missingNameVersion = tempDirectory + "/missing-name-version.zip";

test/spec/ExtensionLoader-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ define(function (require, exports, module) {
3232
SpecRunnerUtils = require("spec/SpecRunnerUtils");
3333

3434
const testPathSrc = SpecRunnerUtils.getTestPath("/spec/ExtensionLoader-test-files");
35-
const testPath = window.__TAURI__ ? Phoenix.VFS.getTauriAssetServeDir() + "tests": SpecRunnerUtils.getTempDirectory();
35+
const testPath = Phoenix.isNativeApp ? Phoenix.VFS.getTauriAssetServeDir() + "tests": SpecRunnerUtils.getTempDirectory();
3636

3737
describe("ExtensionLoader", function () {
3838

0 commit comments

Comments
 (0)