Skip to content

Commit 5c0cf59

Browse files
committed
fix: all unit tests working in electron
1 parent 68aba25 commit 5c0cf59

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

test/spec/ExtensionManager-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ define(function (require, exports, module) {
4949
mockExtensionList = require("text!spec/ExtensionManager-test-files/mockExtensionList.json"),
5050
mockRegistry;
5151

52-
const testPath = window.__TAURI__ ?
52+
const testPath = Phoenix.isNativeApp ?
5353
Phoenix.VFS.getTauriAssetServeDir() + "tests" :
5454
SpecRunnerUtils.getTempDirectory();
5555
const testSrc = SpecRunnerUtils.getTestPath("/spec/ExtensionManager-test-files");

test/spec/LowLevelFileIO-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ define(function (require, exports, module) {
797797
describe("specialDirectories", function () {
798798
it("should have an application support directory", async function () {
799799
// these tests are here as these are absolute unchanging dir convention used by phoenix.
800-
if(window.__TAURI__){
800+
if(Phoenix.isNativeApp){
801801
const appSupportDIR = window.fs.getTauriVirtualPath(window._tauriBootVars.appLocalDir);
802802
expect(brackets.app.getApplicationSupportDirectory().startsWith("/tauri/")).toBeTrue();
803803
expect(brackets.app.getApplicationSupportDirectory()).toBe(appSupportDIR);
@@ -807,7 +807,7 @@ define(function (require, exports, module) {
807807
});
808808
it("should have a user documents directory", function () {
809809
// these tests are here as these are absolute unchanging dir convention used by phoenix.
810-
if(window.__TAURI__){
810+
if(Phoenix.isNativeApp){
811811
const documentsDIR = window.fs.getTauriVirtualPath(window._tauriBootVars.documentDir);
812812
expect(brackets.app.getUserDocumentsDirectory().startsWith("/tauri/")).toBeTrue();
813813
expect(brackets.app.getUserDocumentsDirectory()).toBe(documentsDIR);
@@ -817,7 +817,7 @@ define(function (require, exports, module) {
817817
});
818818
it("should have a user projects directory", function () {
819819
// these tests are here as these are absolute unchanging dir convention used by phoenix.
820-
if(window.__TAURI__){
820+
if(Phoenix.isNativeApp){
821821
const documentsDIR = window.fs.getTauriVirtualPath(window._tauriBootVars.documentDir);
822822
const appName = window._tauriBootVars.appname;
823823
const userProjectsDir = `${documentsDIR}${appName}/`;
@@ -829,7 +829,7 @@ define(function (require, exports, module) {
829829
});
830830
it("should have a temp directory", function () {
831831
// these tests are here as these are absolute unchanging dir convention used by phoenix.
832-
if(window.__TAURI__){
832+
if(Phoenix.isNativeApp){
833833
let tempDIR = window.fs.getTauriVirtualPath(window._tauriBootVars.tempDir);
834834
if(!tempDIR.endsWith("/")){
835835
tempDIR = `${tempDIR}/`;
@@ -844,7 +844,7 @@ define(function (require, exports, module) {
844844
});
845845
it("should have extensions directory", function () {
846846
// these tests are here as these are absolute unchanging dir convention used by phoenix.
847-
if(window.__TAURI__){
847+
if(Phoenix.isNativeApp){
848848
const appSupportDIR = window.fs.getTauriVirtualPath(window._tauriBootVars.appLocalDir);
849849
const extensionsDir = `${appSupportDIR}assets/extensions/`;
850850
expect(brackets.app.getExtensionsDirectory().startsWith("/tauri/")).toBeTrue();
@@ -855,7 +855,7 @@ define(function (require, exports, module) {
855855
});
856856

857857
it("should get virtual serving directory from virtual serving URL in browser", async function () {
858-
if(window.__TAURI__){
858+
if(Phoenix.isNativeApp){
859859
return;
860860
}
861861
expect(brackets.VFS.getPathForVirtualServingURL(`${window.fsServerUrl}blinker`)).toBe("/blinker");
@@ -866,7 +866,7 @@ define(function (require, exports, module) {
866866
});
867867

868868
it("should not get virtual serving directory from virtual serving URL in tauri", async function () {
869-
if(!window.__TAURI__){
869+
if(!Phoenix.isNativeApp){
870870
return;
871871
}
872872
expect(window.fsServerUrl).not.toBeDefined();

0 commit comments

Comments
 (0)