1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

s/beforeEach/beforeAll/ for Olm.init() and cleanup sas.spec.js

This commit is contained in:
Michael Telatynski
2019-11-25 13:26:10 +00:00
parent 7fb807919c
commit 057303d57c
9 changed files with 30 additions and 17 deletions

View File

@@ -25,8 +25,8 @@ describe("Crypto", function() {
return; return;
} }
beforeEach(function(done) { beforeAll(function() {
Olm.init().then(done); return Olm.init();
}); });
it("Crypto exposes the correct olm library version", function() { it("Crypto exposes the correct olm library version", function() {

View File

@@ -25,14 +25,16 @@ describe("MegolmDecryption", function() {
return; return;
} }
beforeAll(function() {
return Olm.init();
});
let megolmDecryption; let megolmDecryption;
let mockOlmLib; let mockOlmLib;
let mockCrypto; let mockCrypto;
let mockBaseApis; let mockBaseApis;
beforeEach(async function() { beforeEach(async function() {
await Olm.init();
mockCrypto = testUtils.mock(Crypto, 'Crypto'); mockCrypto = testUtils.mock(Crypto, 'Crypto');
mockBaseApis = {}; mockBaseApis = {};

View File

@@ -48,12 +48,14 @@ describe("OlmDecryption", function() {
return; return;
} }
beforeAll(function() {
return global.Olm.init();
});
let aliceOlmDevice; let aliceOlmDevice;
let bobOlmDevice; let bobOlmDevice;
beforeEach(async function() { beforeEach(async function() {
await global.Olm.init();
aliceOlmDevice = makeOlmDevice(); aliceOlmDevice = makeOlmDevice();
bobOlmDevice = makeOlmDevice(); bobOlmDevice = makeOlmDevice();
await aliceOlmDevice.init(); await aliceOlmDevice.init();

View File

@@ -128,6 +128,10 @@ describe("MegolmBackup", function() {
return; return;
} }
beforeAll(function() {
return Olm.init();
});
let olmDevice; let olmDevice;
let mockOlmLib; let mockOlmLib;
let mockCrypto; let mockCrypto;
@@ -136,7 +140,6 @@ describe("MegolmBackup", function() {
let cryptoStore; let cryptoStore;
let megolmDecryption; let megolmDecryption;
beforeEach(async function() { beforeEach(async function() {
await Olm.init();
mockCrypto = testUtils.mock(Crypto, 'Crypto'); mockCrypto = testUtils.mock(Crypto, 'Crypto');
mockCrypto.backupKey = new Olm.PkEncryption(); mockCrypto.backupKey = new Olm.PkEncryption();
mockCrypto.backupKey.set_recipient_key( mockCrypto.backupKey.set_recipient_key(

View File

@@ -55,8 +55,8 @@ describe("Cross Signing", function() {
return; return;
} }
beforeEach(async function() { beforeAll(function() {
await global.Olm.init(); return global.Olm.init();
}); });
it("should sign the master key with the device key", async function() { it("should sign the master key with the device key", async function() {

View File

@@ -40,8 +40,8 @@ describe("Secrets", function() {
return; return;
} }
beforeEach(async function() { beforeAll(function() {
await global.Olm.init(); return global.Olm.init();
}); });
it("should store and retrieve a secret", async function() { it("should store and retrieve a secret", async function() {

View File

@@ -33,8 +33,8 @@ describe("QR code verification", function() {
return; return;
} }
beforeEach(async function() { beforeAll(function() {
await Olm.init(); return Olm.init();
}); });
describe("showing", function() { describe("showing", function() {

View File

@@ -35,8 +35,8 @@ describe("verification request", function() {
return; return;
} }
beforeEach(async function() { beforeAll(function() {
await Olm.init(); return Olm.init();
}); });
it("should request and accept a verification", async function() { it("should request and accept a verification", async function() {

View File

@@ -45,8 +45,8 @@ describe("SAS verification", function() {
return; return;
} }
beforeEach(async function() { beforeAll(function() {
await Olm.init(); return Olm.init();
}); });
it("should error on an unexpected event", async function() { it("should error on an unexpected event", async function() {
@@ -169,6 +169,12 @@ describe("SAS verification", function() {
} }
}); });
}); });
afterEach(async function() {
await Promise.all([
alice.stop(),
bob.stop(),
]);
});
it("should verify a key", async function() { it("should verify a key", async function() {
let macMethod; let macMethod;