mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Minor tweals
This commit is contained in:
parent
2280fb5c43
commit
4f5e7367d0
@ -372,7 +372,7 @@ describe('Synchronizer', function() {
|
|||||||
expect(items.length).toBe(1);
|
expect(items.length).toBe(1);
|
||||||
expect(items[0].title).toBe('note1');
|
expect(items[0].title).toBe('note1');
|
||||||
expect(items[0].is_conflict).toBe(1);
|
expect(items[0].is_conflict).toBe(1);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should resolve conflict if note has been deleted remotely and locally', asyncTest(async () => {
|
it('should resolve conflict if note has been deleted remotely and locally', asyncTest(async () => {
|
||||||
let folder = await Folder.save({ title: "folder" });
|
let folder = await Folder.save({ title: "folder" });
|
||||||
@ -542,11 +542,11 @@ describe('Synchronizer', function() {
|
|||||||
let n1 = await Note.save({ title: "mynote" });
|
let n1 = await Note.save({ title: "mynote" });
|
||||||
let n2 = await Note.save({ title: "mynote2" });
|
let n2 = await Note.save({ title: "mynote2" });
|
||||||
let tag = await Tag.save({ title: 'mytag' });
|
let tag = await Tag.save({ title: 'mytag' });
|
||||||
await synchronizer().start();
|
let context1 = await synchronizer().start();
|
||||||
|
|
||||||
await switchClient(2);
|
await switchClient(2);
|
||||||
|
|
||||||
await synchronizer().start();
|
let context2 = await synchronizer().start();
|
||||||
if (withEncryption) {
|
if (withEncryption) {
|
||||||
const masterKey_2 = await MasterKey.load(masterKey.id);
|
const masterKey_2 = await MasterKey.load(masterKey.id);
|
||||||
await encryptionService().loadMasterKey(masterKey_2, '123456', true);
|
await encryptionService().loadMasterKey(masterKey_2, '123456', true);
|
||||||
@ -560,21 +560,21 @@ describe('Synchronizer', function() {
|
|||||||
await Tag.addNote(remoteTag.id, n2.id);
|
await Tag.addNote(remoteTag.id, n2.id);
|
||||||
let noteIds = await Tag.noteIds(tag.id);
|
let noteIds = await Tag.noteIds(tag.id);
|
||||||
expect(noteIds.length).toBe(2);
|
expect(noteIds.length).toBe(2);
|
||||||
await synchronizer().start();
|
context2 = await synchronizer().start({ context: context2 });
|
||||||
|
|
||||||
await switchClient(1);
|
await switchClient(1);
|
||||||
|
|
||||||
await synchronizer().start();
|
context1 = await synchronizer().start({ context: context1 });
|
||||||
let remoteNoteIds = await Tag.noteIds(tag.id);
|
let remoteNoteIds = await Tag.noteIds(tag.id);
|
||||||
expect(remoteNoteIds.length).toBe(2);
|
expect(remoteNoteIds.length).toBe(2);
|
||||||
await Tag.removeNote(tag.id, n1.id);
|
await Tag.removeNote(tag.id, n1.id);
|
||||||
remoteNoteIds = await Tag.noteIds(tag.id);
|
remoteNoteIds = await Tag.noteIds(tag.id);
|
||||||
expect(remoteNoteIds.length).toBe(1);
|
expect(remoteNoteIds.length).toBe(1);
|
||||||
await synchronizer().start();
|
context1 = await synchronizer().start({ context: context1 });
|
||||||
|
|
||||||
await switchClient(2);
|
await switchClient(2);
|
||||||
|
|
||||||
await synchronizer().start();
|
context2 = await synchronizer().start({ context: context2 });
|
||||||
noteIds = await Tag.noteIds(tag.id);
|
noteIds = await Tag.noteIds(tag.id);
|
||||||
expect(noteIds.length).toBe(1);
|
expect(noteIds.length).toBe(1);
|
||||||
expect(remoteNoteIds[0]).toBe(noteIds[0]);
|
expect(remoteNoteIds[0]).toBe(noteIds[0]);
|
||||||
|
@ -57,9 +57,9 @@ SyncTargetRegistry.addClass(SyncTargetNextcloud);
|
|||||||
SyncTargetRegistry.addClass(SyncTargetDropbox);
|
SyncTargetRegistry.addClass(SyncTargetDropbox);
|
||||||
|
|
||||||
// const syncTargetId_ = SyncTargetRegistry.nameToId("nextcloud");
|
// const syncTargetId_ = SyncTargetRegistry.nameToId("nextcloud");
|
||||||
// const syncTargetId_ = SyncTargetRegistry.nameToId("memory");
|
const syncTargetId_ = SyncTargetRegistry.nameToId("memory");
|
||||||
//const syncTargetId_ = SyncTargetRegistry.nameToId('filesystem');
|
//const syncTargetId_ = SyncTargetRegistry.nameToId('filesystem');
|
||||||
const syncTargetId_ = SyncTargetRegistry.nameToId('dropbox');
|
// const syncTargetId_ = SyncTargetRegistry.nameToId('dropbox');
|
||||||
const syncDir = __dirname + '/../tests/sync';
|
const syncDir = __dirname + '/../tests/sync';
|
||||||
|
|
||||||
const sleepTime = syncTargetId_ == SyncTargetRegistry.nameToId('filesystem') ? 1001 : 100;//400;
|
const sleepTime = syncTargetId_ == SyncTargetRegistry.nameToId('filesystem') ? 1001 : 100;//400;
|
||||||
@ -256,7 +256,7 @@ function fileApi() {
|
|||||||
const api = new DropboxApi();
|
const api = new DropboxApi();
|
||||||
const authTokenPath = __dirname + '/support/dropbox-auth.txt';
|
const authTokenPath = __dirname + '/support/dropbox-auth.txt';
|
||||||
const authToken = fs.readFileSync(authTokenPath, 'utf8');
|
const authToken = fs.readFileSync(authTokenPath, 'utf8');
|
||||||
if (!authTokenPath) throw new Error('Dropbox auth token missing in ' + authTokenPath);
|
if (!authToken) throw new Error('Dropbox auth token missing in ' + authTokenPath);
|
||||||
api.setAuthToken(authToken);
|
api.setAuthToken(authToken);
|
||||||
fileApi_ = new FileApi('', new FileApiDriverDropbox(api));
|
fileApi_ = new FileApi('', new FileApiDriverDropbox(api));
|
||||||
}
|
}
|
||||||
@ -301,8 +301,9 @@ function asyncTest(callback) {
|
|||||||
await callback();
|
await callback();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
done();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +85,9 @@ shim.fetchRequestCanBeRetried = function(error) {
|
|||||||
// Code: ETIMEDOUT
|
// Code: ETIMEDOUT
|
||||||
if (error.code === 'ETIMEDOUT') return true;
|
if (error.code === 'ETIMEDOUT') return true;
|
||||||
|
|
||||||
|
// ECONNREFUSED is generally temporary
|
||||||
|
if (error.code === 'ECONNREFUSED') return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user