mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
All: Fixes #3234: Sync would fail in some cases due to a database error
This commit is contained in:
parent
341b763088
commit
bec91863e2
36
CliClient/tests/database.js
Normal file
36
CliClient/tests/database.js
Normal file
@ -0,0 +1,36 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
require('app-module-path').addPath(__dirname);
|
||||
|
||||
const { time } = require('lib/time-utils.js');
|
||||
const { sortedIds, createNTestNotes, asyncTest, fileContentEqual, setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync } = require('test-utils.js');
|
||||
const Folder = require('lib/models/Folder.js');
|
||||
const Note = require('lib/models/Note.js');
|
||||
const Setting = require('lib/models/Setting.js');
|
||||
const BaseModel = require('lib/BaseModel.js');
|
||||
const ArrayUtils = require('lib/ArrayUtils.js');
|
||||
const { shim } = require('lib/shim');
|
||||
|
||||
process.on('unhandledRejection', (reason, p) => {
|
||||
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
||||
});
|
||||
|
||||
describe('database', function() {
|
||||
beforeEach(async (done) => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
await switchClient(1);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should not modify cached field names', asyncTest(async () => {
|
||||
const db = BaseModel.db();
|
||||
|
||||
const fieldNames = db.tableFieldNames('notes');
|
||||
const fieldCount = fieldNames.length;
|
||||
fieldNames.push('type_');
|
||||
|
||||
expect(fieldCount).toBeGreaterThan(0);
|
||||
expect(db.tableFieldNames('notes').length).toBe(fieldCount);
|
||||
}));
|
||||
|
||||
});
|
@ -146,7 +146,7 @@ class JoplinDatabase extends Database {
|
||||
}
|
||||
this.tableFieldNames_[tableName] = output;
|
||||
|
||||
return output;
|
||||
return output.slice();
|
||||
}
|
||||
|
||||
tableFields(tableName, options = null) {
|
||||
|
Loading…
Reference in New Issue
Block a user