fix: bypass first signup screen for tests

This commit is contained in:
thecodrr
2021-08-04 23:27:16 +05:00
parent 080482903f
commit 1f2c6e623d
3 changed files with 33 additions and 29 deletions

View File

@@ -9,8 +9,8 @@ import { getCurrentHash, hashNavigate } from "../navigation";
* @type {import("notes-core/api").default}
*/
var db;
function initializeDatabase() {
return import("notes-core/api").then(async ({ default: Database }) => {
async function initializeDatabase() {
const { default: Database } = await import("notes-core/api");
db = new Database(StorageInterface, EventSource);
// db.host({
// API_HOST: "https://api.notesnook.com",
@@ -32,15 +32,12 @@ function initializeDatabase() {
await db.init();
if (!isAppHydrated()) {
if (process.env.REACT_APP_CI) return;
if (!isAppHydrated() && !process.env.REACT_APP_CI) {
try {
loadDefaultNotes(db);
} catch (e) {}
}
return db;
});
}
export { db, initializeDatabase };

View File

@@ -15,6 +15,7 @@ if (process.env.NODE_ENV === "production") {
initializeDatabase().then(async (db) => {
const isLoggedIn = !!(await db.user.getUser());
if (
!process.env.REACT_APP_CI &&
!isLoggedIn &&
window.location.pathname === "/" &&
!Config.get("skipInitiation", false)

View File

@@ -1926,6 +1926,7 @@
"@notesnook/desktop@./desktop/":
version "1.4.1"
dependencies:
electron-data-storage "^1.0.7"
electron-serve "^1.1.0"
electron-updater "^4.3.8"
node-fetch "^2.6.1"
@@ -5088,6 +5089,11 @@ ejs@^3.1.5:
dependencies:
jake "^10.6.1"
electron-data-storage@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/electron-data-storage/-/electron-data-storage-1.0.7.tgz#983322d44f9af0bb6f5c9cb66eccc291e14ff486"
integrity sha512-dTT1l2DlEk2DqUVgOpaftJLMjRt0AkOGHR9tA2VUUFfs6ORRL+O0JJR93zjQngZCA9U9g/N0VBbsINdZDiVQGg==
electron-serve@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/electron-serve/-/electron-serve-1.1.0.tgz#507f56c8512c501880d3a9bec792fa92512af378"