1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

All: Improved E2EE usability by making its state a property of the sync target (#5276)

This commit is contained in:
Laurent
2021-08-12 16:54:10 +01:00
committed by GitHub
parent ba3cbfa051
commit dcd5a8d975
102 changed files with 1775 additions and 551 deletions

View File

@ -0,0 +1,34 @@
import { encryptionService, msleep, setupDatabaseAndSynchronizer, switchClient } from '../testing/test-utils';
import MasterKey from './MasterKey';
describe('models/MasterKey', function() {
beforeEach(async (done) => {
await setupDatabaseAndSynchronizer(1);
await switchClient(1);
done();
});
it('should return the latest master key', (async () => {
expect(await MasterKey.latest()).toBeFalsy();
let mk1 = await encryptionService().generateMasterKey('111111');
mk1 = await MasterKey.save(mk1);
expect((await MasterKey.latest()).id).toBe(mk1.id);
await msleep(1);
let mk2 = await encryptionService().generateMasterKey('111111');
mk2 = await MasterKey.save(mk2);
expect((await MasterKey.latest()).id).toBe(mk2.id);
await msleep(1);
mk1 = await MasterKey.save(mk1);
expect((await MasterKey.latest()).id).toBe(mk1.id);
}));
});