2020-05-20 00:17:56 +02:00
|
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
|
2020-11-05 18:58:23 +02:00
|
|
|
|
2020-11-07 17:59:37 +02:00
|
|
|
const time = require('@joplin/lib/time').default;
|
2020-12-01 20:05:24 +02:00
|
|
|
const { sortedIds, createNTestNotes, fileContentEqual, setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync } = require('./test-utils.js');
|
2020-11-07 17:59:37 +02:00
|
|
|
const Folder = require('@joplin/lib/models/Folder.js');
|
|
|
|
const Note = require('@joplin/lib/models/Note.js');
|
|
|
|
const Setting = require('@joplin/lib/models/Setting').default;
|
|
|
|
const BaseModel = require('@joplin/lib/BaseModel').default;
|
|
|
|
const ArrayUtils = require('@joplin/lib/ArrayUtils.js');
|
|
|
|
const shim = require('@joplin/lib/shim').default;
|
2020-05-20 00:17:56 +02:00
|
|
|
|
|
|
|
describe('database', function() {
|
|
|
|
beforeEach(async (done) => {
|
|
|
|
await setupDatabaseAndSynchronizer(1);
|
|
|
|
await switchClient(1);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
2020-12-01 20:05:24 +02:00
|
|
|
it('should not modify cached field names', (async () => {
|
2020-05-20 00:17:56 +02:00
|
|
|
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);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|