You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-07 23:02:56 +03:00
move export test with other Olm tests to have active sessions
This commit is contained in:
committed by
Cédric Van Rompay
parent
8db38f8e75
commit
3a1cdd37a3
@@ -41,29 +41,7 @@ async function setupSession(initiator, opponent) {
|
|||||||
return sid;
|
return sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("OlmDevice", () => {
|
describe("OlmDevice", function() {
|
||||||
if (!global.Olm) {
|
|
||||||
logger.warn('Not running megolm unit tests: libolm not present');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
beforeAll(function() {
|
|
||||||
return global.Olm.init();
|
|
||||||
});
|
|
||||||
|
|
||||||
let olmDevice;
|
|
||||||
|
|
||||||
beforeEach(async function() {
|
|
||||||
olmDevice = makeOlmDevice();
|
|
||||||
await olmDevice.init();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('exports picked account and olm sessions', async function() {
|
|
||||||
console.log('EXPORT RESULT:', await olmDevice.export());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("OlmDecryption", function() {
|
|
||||||
if (!global.Olm) {
|
if (!global.Olm) {
|
||||||
logger.warn('Not running megolm unit tests: libolm not present');
|
logger.warn('Not running megolm unit tests: libolm not present');
|
||||||
return;
|
return;
|
||||||
@@ -103,6 +81,24 @@ describe("OlmDecryption", function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('exports picked account and olm sessions', async function() {
|
||||||
|
await setupSession(aliceOlmDevice, bobOlmDevice);
|
||||||
|
|
||||||
|
let exported = await aliceOlmDevice.export();
|
||||||
|
expect(exported).toHaveProperty('pickleKey');
|
||||||
|
expect(exported).toHaveProperty('pickledAccount');
|
||||||
|
expect(exported).toHaveProperty('sessions');
|
||||||
|
expect(Array.isArray(exported.sessions)).toBe(true);
|
||||||
|
expect(exported.sessions[0]).toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
session: expect.any(String),
|
||||||
|
lastReceivedMessageTs: expect.any(Number),
|
||||||
|
deviceKey: expect.any(String),
|
||||||
|
sessionId: expect.any(String),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("creates only one session at a time", async function() {
|
it("creates only one session at a time", async function() {
|
||||||
// if we call ensureOlmSessionsForDevices multiple times, it should
|
// if we call ensureOlmSessionsForDevices multiple times, it should
|
||||||
// only try to create one session at a time, even if the server is
|
// only try to create one session at a time, even if the server is
|
||||||
|
Reference in New Issue
Block a user