1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-13 19:42:25 +03:00
Commit Graph

29 Commits

Author SHA1 Message Date
Travis Ralston
18ccceca2d [CONFLICT CHUNKS] Merge branch 'develop' into travis/sourcemaps-dev 2020-01-07 14:37:17 -07:00
Hubert Chathi
01f6b3dfc6 notify devices when we don't send them keys (#1135)
and handle incoming notifications
2020-01-06 17:47:22 -05:00
Travis Ralston
f952f6742f Remove ancient "use strict" annotations
We don't need these anymore. Theoretically this commit could go to develop, but for safety it's going to `travis/sourcemaps` first.
2019-12-17 15:43:02 -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
Travis Ralston
ca6a52727c Fix logger imports in tests 2019-12-10 11:39:56 -07:00
Michael Telatynski
1286007b2e Rip out bluebird of a bunch of places, lots to go :( 2019-12-02 22:34:46 +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
Janith Kasun
de8063a43a Merge branch 'develop' into loglevel-extend 2019-05-19 09:40:38 +05:30
jkasun
a73dabcb67 Console logging to loglevel 2019-05-19 09:29:40 +05:30
J. Ryan Stinnett
761806c678 Add support for class properties
This enables compiler and linting features to allow class properties like we do
in the React SDK.
2019-05-13 13:52:37 +01:00
David Baker
1caf2b7f83 Always track our own devices
It's generally a reasonable assumption that we'll be interested in
them, and important for key backup.

Fixes https://github.com/vector-im/riot-web/issues/8213
2019-02-06 16:48:57 +00:00
Travis Ralston
fed67192bc Fix test: Actually resend the event after unknown devices are found
This test didn't actually test that resending would work, despite its name.
2018-11-08 17:17:30 -07:00
David Baker
2b752c0c02 Use new stop() method on matrix-mock-request
To finish all pending flushes between tests. This stops the unit
tests from hanging on node 11 when run in certain combinations.

Requires https://github.com/matrix-org/matrix-mock-request/pull/6
(so will need a release of matrix-mock-request before merging)
2018-10-25 14:29:25 +01:00
Richard van der Hoff
ca8674e0de Factor out devicelist integration tests to a separate file
There's a fuzzy line between the megolm tests and the devicelist ones, but
since I want to add more tests for devicelists, we might as well put the ones
which are definitely about devicelists in their own file
2017-09-08 11:54:16 +01:00
Richard van der Hoff
9f2fce4d87 Try harder to wait for megolm decryption
Ok, this *really* ought to fix the racy test.
2017-08-16 19:01:47 +01:00
Richard van der Hoff
12212409c7 Hopefully, fix racy megolm test
I couldn't repro the failure locally, but this looks like it should fix the
test failures.
2017-08-15 19:09:50 +01:00
Richard van der Hoff
c870930bc0 Add delays to tests to wait for things to decrypt
Prepare for some refactoring which will add an extra tick to decryption by
adding some `awaitDecryption` calls in the integration tests.
2017-08-10 15:01:56 +01:00
Richard van der Hoff
d1e91cd702 Add MatrixClient.initCrypto
initialising the crypto layer needs to become asynchronous. Rather than making
`sdk.createClient` asynchronous, which would break every single app in the
world, add `initCrypto`, which will only break those attempting to do e2e (and
in a way which will fall back to only supporting unencrypted events).
2017-07-18 23:35:33 +01:00
Richard van der Hoff
04ca0ac2b5 Give the megolm tests longer to complete
All that crypto stuff takes a while, so give it longer than 100ms.
2017-07-14 15:22:08 +01:00
Richard van der Hoff
cfffbc4a09 replace q method calls with bluebird ones
```
find src spec -name '*.js' |
    xargs perl -i -pe 's/q\.(all|defer|reject|delay|try)\(/Promise.$1(/'
```
2017-07-12 23:33:55 +01:00
Richard van der Hoff
b96062b6de replace imports of q with bluebird
```
find src spec -name '*.js' |
   xargs perl -i -pe 'if (/require\(.q.\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'

find src spec -name '*.js' |
   xargs perl -i -pe 'if (/import q/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
```
2017-07-12 23:32:28 +01:00
Richard van der Hoff
651baefb1d Remove redundant expectations
Apparently we weren't hitting these expected requests, so let's get rid of them.
2017-07-12 17:25:59 +01:00
Richard van der Hoff
ff7e845615 remove redundant flushAllExpected
Turned out this flush was completely redundant
2017-07-12 17:23:11 +01:00
Richard van der Hoff
f0612a1407 Fix some more flakey tests
switch a bunch of `flush()`es to `flushAllExpected()`s
2017-07-12 16:28:21 +01:00
Richard van der Hoff
0ca4d728d8 Fix a bunch of races in the tests
Once we switch to bluebird, suddenly a load of timing issues come out of the
woodwork. Basically, we need to try harder when flushing requests. Bump to
matrix-mock-request 1.1.0, which provides `flushAllExpected`, and waits for
requests to arrive when given a `numToFlush`; then use `flushAllExpected` in
various places to make the tests more resilient.
2017-07-11 12:09:21 +01:00
Richard van der Hoff
3bfb4595cf Remove redundant calls to done
These tests which return a promise already don't need to call `done`.
2017-07-10 17:40:23 +01:00
Richard van der Hoff
f21ea6c065 Extend timeout in megolm test
Use the default timeout of 100ms when waiting for the /send request, instead of
clamping it to 20ms.
2017-07-05 15:08:50 +01:00
Richard van der Hoff
ae950a2ff4 Fix some races in the tests
There is a common pattern in the tests which is, when we want to mock a /sync,
to flush it, and then, in the next tick of the promise loop, to wait for the
syncing event. However, this is racy: there is no guarantee that the syncing
event will not happen before the next tick of the promise loop.

Instead, we should set the expectation of the syncing event, then do the flush.
(Technically we only need to wait for the syncing event, but by waiting for
both we'll catch any errors thrown by the flush, and make sure we don't have
any outstanding flushes before proceeding).

Add a utility method to TestClient to do the above, and use it where we have a
TestClient.

(Also fixes a couple of other minor buglets in the tests).
2017-07-04 13:48:26 +01:00
Richard van der Hoff
e2f4c0ffd1 Rename megolm integration tests
I'm going to introduce some separate unit tests, so let's give this a different
filename to reduce confusion.
2017-06-20 11:51:11 +01:00