From 09bcf8df3530226ce7d8bb66888a629158a7be78 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sun, 2 Jul 2017 22:01:37 +0100 Subject: [PATCH] Improved test unit --- CliClient/tests/synchronizer.js | 4 ++++ lib/models/note.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CliClient/tests/synchronizer.js b/CliClient/tests/synchronizer.js index 63fe94dd60..4776cf29ca 100644 --- a/CliClient/tests/synchronizer.js +++ b/CliClient/tests/synchronizer.js @@ -385,6 +385,10 @@ describe('Synchronizer', function() { expect(conflictedNotes.length).toBe(1); expect(conflictedNotes[0].title).toBe(newTitle); + + let unconflictedNotes = await Note.unconflictedNotes(); + + expect(unconflictedNotes.length).toBe(0); done(); }); diff --git a/lib/models/note.js b/lib/models/note.js index ec0708c309..394b2391b7 100644 --- a/lib/models/note.js +++ b/lib/models/note.js @@ -88,6 +88,10 @@ class Note extends BaseItem { return this.modelSelectAll('SELECT * FROM notes WHERE is_conflict = 1'); } + static unconflictedNotes() { + return this.modelSelectAll('SELECT * FROM notes WHERE is_conflict = 0'); + } + static updateGeolocation(noteId) { Log.info('Updating lat/long of note ' + noteId);