Page MenuHomePhorge

D7090.1765068961.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D7090.1765068961.diff

diff --git a/keyserver/jest-setup.js b/keyserver/jest-setup.js
new file mode 100644
--- /dev/null
+++ b/keyserver/jest-setup.js
@@ -0,0 +1,8 @@
+// @flow
+
+import crypto from 'crypto';
+
+// crypto.webcrypto was introduced in Node 15.10.0.
+// It is not defined in Flow so we need a cast
+// eslint-disable-next-line no-undef -- "global is not defined"
+global.crypto = (crypto: any).webcrypto;
diff --git a/keyserver/package.json b/keyserver/package.json
--- a/keyserver/package.json
+++ b/keyserver/package.json
@@ -97,6 +97,9 @@
},
"transformIgnorePatterns": [
"/node_modules/(?!@babel/runtime)"
+ ],
+ "setupFiles": [
+ "<rootDir>/jest-setup.js"
]
}
}
diff --git a/keyserver/src/utils/olm-utils.test.js b/keyserver/src/utils/olm-utils.test.js
--- a/keyserver/src/utils/olm-utils.test.js
+++ b/keyserver/src/utils/olm-utils.test.js
@@ -10,4 +10,11 @@
const utility = getOlmUtility();
expect(utility).not.toBe(undefined);
});
+ it('should be able to generate and return prekey', async () => {
+ await olm.init();
+ const account = new olm.Account();
+ account.create();
+ account.generate_prekey();
+ expect(account.prekey()).not.toBe(undefined);
+ });
});
diff --git a/web/olm/olm.test.js b/web/olm/olm.test.js
--- a/web/olm/olm.test.js
+++ b/web/olm/olm.test.js
@@ -8,4 +8,11 @@
const account = new olm.Account();
expect(account).not.toBe(undefined);
});
+ it('should be able to generate and return prekey', async () => {
+ await olm.init();
+ const account = new olm.Account();
+ account.create();
+ account.generate_prekey();
+ expect(account.prekey()).not.toBe(undefined);
+ });
});

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 7, 12:56 AM (13 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5841773
Default Alt Text
D7090.1765068961.diff (1 KB)

Event Timeline