Skip to content

Commit a0b4372

Browse files
committed
fix: all tests working in electron
1 parent 5b5b01b commit a0b4372

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/spec/Storage-integ-test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ define(function (require, exports, module) {
122122
expect(val).toEql(expectedValue);
123123
});
124124

125-
it("Should be able to create lmdb dumps in tauri", async function () {
125+
it("Should be able to create lmdb dumps in native app", async function () {
126126
if(!Phoenix.isNativeApp){
127127
return;
128128
}
@@ -137,7 +137,14 @@ define(function (require, exports, module) {
137137
});
138138

139139
const dumpFileLocation = await window.storageNodeConnector.execPeer("dumpDBToFile");
140-
const dumpFileText = await window.__TAURI__.fs.readTextFile(dumpFileLocation);
140+
let dumpFileText;
141+
if (window.__TAURI__) {
142+
dumpFileText = await window.__TAURI__.fs.readTextFile(dumpFileLocation);
143+
} else if (window.__ELECTRON__) {
144+
const data = await window.electronFSAPI.fsReadFile(dumpFileLocation);
145+
const decoder = new TextDecoder("utf-8");
146+
dumpFileText = decoder.decode(data);
147+
}
141148
const dumpObj = JSON.parse(dumpFileText);
142149
expect(dumpObj[key]).toEql(expectedValue);
143150
});

0 commit comments

Comments
 (0)