2021-05-21 15:17:21 +02:00
|
|
|
const { setupDatabaseAndSynchronizer, switchClient } = require('./testing/test-utils.js');
|
|
|
|
const BaseModel = require('./BaseModel').default;
|
|
|
|
|
2023-02-20 17:02:29 +02:00
|
|
|
describe('database', () => {
|
2022-11-15 12:23:50 +02:00
|
|
|
beforeEach(async () => {
|
2021-05-21 15:17:21 +02:00
|
|
|
await setupDatabaseAndSynchronizer(1);
|
|
|
|
await switchClient(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not modify cached field names', (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);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|