Skip to content

Commit e07b0f4

Browse files
committed
Test to ensure CryptoClient stores outbound group sessions as inbound too
1 parent 19b09bf commit e07b0f4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/encryption/CryptoClientTest.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,15 @@ describe('CryptoClient', () => {
17211721
});
17221722
client.cryptoStore.storeOutboundGroupSession = storeSpy;
17231723

1724+
const ibStoreSpy = simple.stub().callFn(async (s) => {
1725+
expect(s.sessionId).toBeDefined();
1726+
expect(s.roomId).toEqual(roomId);
1727+
expect(s.senderUserId).toEqual(userId);
1728+
expect(s.senderDeviceId).toEqual(TEST_DEVICE_ID);
1729+
expect(s.pickled).toBeDefined();
1730+
});
1731+
client.cryptoStore.storeInboundGroupSession = ibStoreSpy;
1732+
17241733
const joinedSpy = simple.stub().callFn(async (rid) => {
17251734
expect(rid).toEqual(roomId);
17261735
return Object.keys(deviceMap);
@@ -1763,6 +1772,7 @@ describe('CryptoClient', () => {
17631772
expect(devicesSpy.callCount).toBe(1);
17641773
expect(toDeviceSpy.callCount).toBe(1);
17651774
expect(storeSpy.callCount).toBe(1);
1775+
expect(ibStoreSpy.callCount).toBe(1);
17661776
expect(result).toMatchObject({
17671777
algorithm: "m.megolm.v1.aes-sha2",
17681778
sender_key: "BZ2AhgUQPramkd0qQ6m6rcIM9cMwNE1fjI784sW3dSM",
@@ -1772,10 +1782,6 @@ describe('CryptoClient', () => {
17721782
});
17731783
});
17741784

1775-
it.skip('should store created outbound sessions as inbound sessions', async () => {
1776-
// TODO: Merge into above test when functionality exists.
1777-
});
1778-
17791785
it.skip('should get devices for invited members', async () => {
17801786
// TODO: Support invited members, if history visibility would allow.
17811787
});

0 commit comments

Comments
 (0)