1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00
Commit Graph

35 Commits

Author SHA1 Message Date
Travis Ralston
95c2c1643e Remove "source-map-support" from tests because it makes sourcemaps worse
Now that we're pointing at `src/` for tests, we can stop trying to load source maps from random places. With this dependency used, source maps are off by a few lines.
2019-12-17 15:45:15 -07:00
Travis Ralston
034b8db070 Convert tests to ES6
The earlier commit, d3ce0cb82f, has most of the juicy details on this. In addition to d3ce's changes, we also:
* Use `TestClient` in many integration tests due to subtle behaviour changes in imports when switching to ES6. Namely the behaviour where setting the request function is less reliable in the way we did it, but `TestClient` is very reliable.
* We now use the Olm loader more often to avoid having to maintain so much duplicate code. This makes the imports slightly easier to read.
2019-12-17 15:16:37 -07:00
Michael Telatynski
ebe174fbef lets *not* get rid of pointless waits :D
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-12-04 23:47:53 +00:00
Michael Telatynski
bf45c176a7 get rid of bunch of seemingly pointless waits
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-12-04 23:42:16 +00:00
Michael Telatynski
87a8e4c216 Apply uhoreg's patch (with jesty stuff changed out)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-12-04 23:37:49 +00:00
Michael Telatynski
30cc7d4f0f Fix one of the crypto.spec.js failures
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-12-04 23:31:20 +00:00
Travis Ralston
18749c580e Fix Olm unwedging test
Deep within the crypto layers we call `getId()`, and when we don't have that function the async call on the emitter fails but doesn't fail the test. This manifests as a timeout because the code path that would call the thing blew up.
2019-11-26 15:06:56 -07:00
Michael Telatynski
057303d57c s/beforeEach/beforeAll/ for Olm.init() and cleanup sas.spec.js 2019-11-25 13:26:10 +00:00
Michael Telatynski
fd58957b06 migrate to jest from mocha+expect+istanbul
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-11-20 19:52:50 +00:00
Hubert Chathi
81946294d8 use lolex to fake the timer 2019-03-06 14:42:52 -05:00
Hubert Chathi
9e29289dcc use a different transaction ID when re-sending a key request 2019-03-06 12:02:48 -05:00
Hubert Chathi
5480e8e1d5 refactor key sharing requests
use sendRoomKeyRequest with a new resend flag, instead of cancelRoomKeyRequest,
when requesting keys, so that we make sure that we send a new request if there
is no previous request

fixes https://github.com/vector-im/riot-web/issues/6838
2019-03-04 17:09:56 -05:00
Hubert Chathi
98fdcabc00 stop client after each test 2019-03-04 16:59:54 -05:00
Hubert Chathi
86ef262799 fix c+p comment 2019-03-01 12:15:59 -05:00
Hubert Chathi
a1be24307a lint 2019-02-28 22:54:46 -05:00
Hubert Chathi
4b5623691b handle partially-shared sessions better
- don't cancel key requests if we can't decrypt everything in the session
- overwrite the session key if we get a better version
2019-02-28 16:01:29 -05:00
J. Ryan Stinnett
5e3f42ec5a Use olm-loader in all crypto tests
Standardize on importing `olm-loader` rather than pasting the same boilerplate
in different tests.  Importantly, `spec/unit/crypto.spec.js` did not include any
loading approach, so it would only find Olm if some other test loaded it first.

Signed-off-by: J. Ryan Stinnett <jryans@gmail.com>
2018-12-13 08:59:57 +00:00
J. Ryan Stinnett
6cf9563441 Avoid checking key backup status if guest
Fixes vector-im/riot-web#7839.

Signed-off-by: J. Ryan Stinnett <jryans@gmail.com>
2018-12-12 22:26:01 +00:00
David Baker
d99a22d68d Update to new API
Also fix test & remove debug logging from test
2018-11-16 14:46:18 +00:00
David Baker
d74ed508f9 Restart broken Olm sessions
* Start a new Olm sessions with a device when we get an undecryptable
   message on it.
 * Send a dummy message on that sessions such that the other end knows
   about it.
 * Re-send any outstanding keyshare requests for that device.

Also includes a unit test for megolm that isn't very related but came
out as a result anyway.

Includes https://github.com/matrix-org/matrix-js-sdk/pull/776
Fixes https://github.com/vector-im/riot-web/issues/3822
2018-11-08 19:09:28 +00:00
David Baker
3a316de9ef Update to Olm 3 here too 2018-10-24 17:40:58 +01:00
David Baker
b9e198c172 Oops: remove debug logging 2018-10-15 11:39:39 +01:00
David Baker
63cc3fd890 lint 2018-09-25 18:14:11 +01:00
David Baker
c556ca40b1 Support Olm with WebAssembly
wasm Olm has a new interface: it now has an init method that needs
to be called and the promise it returns waited on before the Olm
module is used. Support that, and allow Crypto etc to be imported
whether Olm is enabled or not. Change whether olm is enabled to
be async since now it will be unavailable if the async module init
fails. Don't call getOlmVersion() until the Olm.init() is done.
2018-09-25 17:49:54 +01:00
Richard van der Hoff
bd226d94d8 Switch from jasmine to mocha + expect + lolex
Much of this transformation has been done automatically:
 * add expect import to each file
 * replace `not.to` with `toNot`
 * replace `to[Not]Be{Undefined,Null}` with equivalents
 * replace `jasmine.createSpy(...)` with `except.createSpy`, and `andCallFake`
   with `andCall`

Also:
 * replace `jasmine.createSpyObj` with manual alternatives
 * replace `jasmine.Clock` with `lolex`
2017-02-08 14:32:37 +00:00
Richard van der Hoff
8a487ca1bc Merge branch 'rav/source_map_support' into develop 2017-02-08 11:35:27 +00:00
Richard van der Hoff
80d0aadbd0 Install source-map-support in each test
This makes exception traces use the source map, which is much more helpful when
debugging.
2017-02-07 22:57:09 +00:00
Richard van der Hoff
d744cecbfa Make the tests work without olm
Olm is an optional dependency, so the tests should work without it.
2017-02-07 22:56:56 +00:00
David Baker
7bca05af64 eslint ---fix for prefer-const 2017-01-19 17:42:10 +00:00
Kegan Dougal
7ed65407e6 Pass through eslint --fix 2017-01-13 10:49:32 +00:00
Richard van der Hoff
14fac241f7 bump to olm 2.1.0 2016-12-23 14:36:22 +00:00
Richard van der Hoff
b11bff5a5b Bump to Olm 2.0
... since the code requires it. Also update the tests.
2016-12-14 14:15:31 +00:00
Mark Haines
eb4166afe3 Whitespace 2016-09-15 14:36:53 +01:00
Mark Haines
b3beaacec7 Remove unnecessary dep 2016-09-15 14:26:05 +01:00
Mark Haines
577b0e8f1b Add a test to check the olm version 2016-09-15 14:08:25 +01:00