mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
Started support for onedrive tests
This commit is contained in:
parent
3fad338e28
commit
971c3e12dc
@ -29,8 +29,9 @@ Resource.fsDriver_ = fsDriver;
|
||||
const logDir = __dirname + '/../tests/logs';
|
||||
fs.mkdirpSync(logDir, 0o755);
|
||||
|
||||
//const syncTargetId_ = Setting.SYNC_TARGET_MEMORY;
|
||||
const syncTargetId_ = Setting.SYNC_TARGET_FILESYSTEM;
|
||||
const syncTargetId_ = Setting.SYNC_TARGET_MEMORY;
|
||||
//const syncTargetId_ = Setting.SYNC_TARGET_FILESYSTEM;
|
||||
//const syncTargetId_ = Setting.SYNC_TARGET_ONEDRIVE;
|
||||
const syncDir = __dirname + '/../tests/sync';
|
||||
|
||||
const sleepTime = syncTargetId_ == Setting.SYNC_TARGET_FILESYSTEM ? 1001 : 200;
|
||||
@ -147,11 +148,26 @@ function fileApi() {
|
||||
fs.removeSync(syncDir)
|
||||
fs.mkdirpSync(syncDir, 0o755);
|
||||
fileApi_ = new FileApi(syncDir, new FileApiDriverLocal());
|
||||
} else {
|
||||
} else if (syncTargetId_ == Setting.SYNC_TARGET_MEMORY) {
|
||||
fileApi_ = new FileApi('/root', new FileApiDriverMemory());
|
||||
fileApi_.setLogger(logger);
|
||||
|
||||
}
|
||||
// } else if (syncTargetId == Setting.SYNC_TARGET_ONEDRIVE) {
|
||||
// let auth = require('./onedrive-auth.json');
|
||||
// if (!auth) {
|
||||
// const oneDriveApiUtils = new OneDriveApiNodeUtils(oneDriveApi);
|
||||
// auth = await oneDriveApiUtils.oauthDance();
|
||||
// fs.writeFileSync('./onedrive-auth.json', JSON.stringify(auth));
|
||||
// process.exit(1);
|
||||
// } else {
|
||||
// auth = JSON.parse(auth);
|
||||
// }
|
||||
|
||||
// // const oneDriveApiUtils = new OneDriveApiNodeUtils(reg.oneDriveApi());
|
||||
// // const auth = await oneDriveApiUtils.oauthDance(this);
|
||||
// // Setting.setValue('sync.3.auth', auth ? JSON.stringify(auth) : null);
|
||||
// // if (!auth) return;
|
||||
// }
|
||||
|
||||
fileApi_.setLogger(logger);
|
||||
fileApi_.setSyncTargetId(syncTargetId_);
|
||||
|
@ -245,7 +245,11 @@ class JoplinDatabase extends Database {
|
||||
// Will throw if the database has not been created yet, but this is handled below
|
||||
versionRow = await this.selectOne('SELECT * FROM version LIMIT 1');
|
||||
} catch (error) {
|
||||
console.info(error);
|
||||
if (error.message && (error.message.indexOf('no such table: version') >= 0)) {
|
||||
// Ignore
|
||||
} else {
|
||||
console.info(error);
|
||||
}
|
||||
}
|
||||
|
||||
const version = !versionRow ? 0 : versionRow.version;
|
||||
|
@ -440,6 +440,7 @@ async function initialize(dispatch, backButtonHandler) {
|
||||
await db.open({ name: 'joplin.sqlite' })
|
||||
} else {
|
||||
await db.open({ name: 'joplin-66.sqlite' })
|
||||
//await db.open({ name: 'joplin-67.sqlite' })
|
||||
|
||||
// await db.exec('DELETE FROM notes');
|
||||
// await db.exec('DELETE FROM folders');
|
||||
|
Loading…
Reference in New Issue
Block a user